From a1582aa8cba1cb874a48bccb8818eb3c57ee9a1b Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 16 Jul 2023 14:39:34 +0200 Subject: [PATCH] [PR #6906/b818afd4 backport][stable-7] Fix key error for reverse zone (#6905) (#6951) 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 (cherry picked from commit b818afd46426cacbec6191a0f2a28927139aad19) Co-authored-by: irozet12 <119814380+irozet12@users.noreply.github.com> --- 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})