From 767e9076a5c0f1187c491d18cfc10b54ce0161b9 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 15 Feb 2021 09:04:50 +0100 Subject: [PATCH] ease limitation for nios_host_record DNS Bypass (#1788) (#1825) * ease limitation for nios_host_record DNS Bypass, the bypass should be allowed when configure_dns is disabled and view is set other than default * add changelog fragment Co-authored-by: Nils (cherry picked from commit 8fae693d9cf003ac34bd51814a418fa49038f263) Co-authored-by: shieni --- .../1788-ease-nios_host_record-dns-bypass-check.yml | 3 +++ plugins/module_utils/net_tools/nios/api.py | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/1788-ease-nios_host_record-dns-bypass-check.yml diff --git a/changelogs/fragments/1788-ease-nios_host_record-dns-bypass-check.yml b/changelogs/fragments/1788-ease-nios_host_record-dns-bypass-check.yml new file mode 100644 index 0000000000..6b1a43cc25 --- /dev/null +++ b/changelogs/fragments/1788-ease-nios_host_record-dns-bypass-check.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - nios_host_record - allow DNS Bypass for views other than default (https://github.com/ansible-collections/community.general/issues/1786). diff --git a/plugins/module_utils/net_tools/nios/api.py b/plugins/module_utils/net_tools/nios/api.py index 6cded8e1c8..91dcbad564 100644 --- a/plugins/module_utils/net_tools/nios/api.py +++ b/plugins/module_utils/net_tools/nios/api.py @@ -251,13 +251,10 @@ class WapiModule(WapiBase): else: proposed_object[key] = self.module.params[key] - # If configure_by_dns is set to False, then delete the default dns set in the param else throw exception + # If configure_by_dns is set to False and view is 'default', then delete the default dns if not proposed_object.get('configure_for_dns') and proposed_object.get('view') == 'default'\ and ib_obj_type == NIOS_HOST_RECORD: del proposed_object['view'] - elif not proposed_object.get('configure_for_dns') and proposed_object.get('view') != 'default'\ - and ib_obj_type == NIOS_HOST_RECORD: - self.module.fail_json(msg='DNS Bypass is not allowed if DNS view is set other than \'default\'') if ib_obj_ref: if len(ib_obj_ref) > 1: