From b818afd46426cacbec6191a0f2a28927139aad19 Mon Sep 17 00:00:00 2001 From: irozet12 <119814380+irozet12@users.noreply.github.com> Date: Sun, 16 Jul 2023 11:57:45 +0300 Subject: [PATCH] Fix key error for reverse zone (#6905) (#6906) * Fix key error for reverse zone (#6905) * Add changelog fragment for #6905 * Fix changelog (6905) Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein --- changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml | 2 ++ plugins/modules/ipa_dnszone.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml diff --git a/changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml b/changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml new file mode 100644 index 0000000000..d7ce19d8b9 --- /dev/null +++ b/changelogs/fragments/6905-ipa_dnszone-key-error-fix.yml @@ -0,0 +1,2 @@ +bugfixes: + - ipa_dnszone - fix 'idnsallowsyncptr' key error for reverse zone (https://github.com/ansible-collections/community.general/pull/6906, https://github.com/ansible-collections/community.general/issues/6905). diff --git a/plugins/modules/ipa_dnszone.py b/plugins/modules/ipa_dnszone.py index 06c93841ea..6699b0525b 100644 --- a/plugins/modules/ipa_dnszone.py +++ b/plugins/modules/ipa_dnszone.py @@ -152,7 +152,8 @@ def ensure(module, client): changed = True if not module.check_mode: client.dnszone_add(zone_name=zone_name, details={'idnsallowdynupdate': dynamicupdate, 'idnsallowsyncptr': allowsyncptr}) - elif ipa_dnszone['idnsallowdynupdate'][0] != str(dynamicupdate).upper() or ipa_dnszone['idnsallowsyncptr'][0] != str(allowsyncptr).upper(): + elif ipa_dnszone['idnsallowdynupdate'][0] != str(dynamicupdate).upper() or \ + ipa_dnszone.get('idnsallowsyncptr') and ipa_dnszone['idnsallowsyncptr'][0] != str(allowsyncptr).upper(): changed = True if not module.check_mode: client.dnszone_mod(zone_name=zone_name, details={'idnsallowdynupdate': dynamicupdate, 'idnsallowsyncptr': allowsyncptr})