From 3194ed9d36c0fd6a5bf05899c1a3d1af227cf66d Mon Sep 17 00:00:00 2001 From: Dor Breger <75537576+DorBreger@users.noreply.github.com> Date: Fri, 13 Mar 2026 22:01:50 +0200 Subject: [PATCH] ipa_dnsrecord fix error when using dnsttl and nothing to change (#11559) * ipa_dnsrecord fix error when using dnsttl and nothing to change * Add changelog and bump version * ipa_dnsrecord list comp in dnsrecord_find Co-authored-by: Felix Fontein * 11559 changelog fragment fix capitalization * ipa_dnsrecord dnsrecord_find ttl transform to integer always * ipa_dnsrecord dnsrecord_find method refactor --------- Co-authored-by: Felix Fontein --- .../11559-fix-ipa_dnsrecord-fail-when-no-change.yaml | 2 ++ plugins/modules/ipa_dnsrecord.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/11559-fix-ipa_dnsrecord-fail-when-no-change.yaml diff --git a/changelogs/fragments/11559-fix-ipa_dnsrecord-fail-when-no-change.yaml b/changelogs/fragments/11559-fix-ipa_dnsrecord-fail-when-no-change.yaml new file mode 100644 index 0000000000..c7630cfebc --- /dev/null +++ b/changelogs/fragments/11559-fix-ipa_dnsrecord-fail-when-no-change.yaml @@ -0,0 +1,2 @@ +bugfixes: + - ipa_dnsrecord - fix idempotency bug when using ``dnsttl`` due to wrong Python types (https://github.com/ansible-collections/community.general/pull/11559). diff --git a/plugins/modules/ipa_dnsrecord.py b/plugins/modules/ipa_dnsrecord.py index 3073978a80..e6c8fd2dd5 100644 --- a/plugins/modules/ipa_dnsrecord.py +++ b/plugins/modules/ipa_dnsrecord.py @@ -206,9 +206,12 @@ class DNSRecordIPAClient(IPAClient): def dnsrecord_find(self, zone_name, record_name): if record_name == "@": - return self._post_json(method="dnsrecord_show", name=zone_name, item={"idnsname": record_name, "all": True}) + method = "dnsrecord_show" else: - return self._post_json(method="dnsrecord_find", name=zone_name, item={"idnsname": record_name, "all": True}) + method = "dnsrecord_find" + result = self._post_json(method=method, name=zone_name, item={"idnsname": record_name, "all": True}) + result["dnsttl"] = [int(v) for v in result["dnsttl"]] + return result def dnsrecord_add(self, zone_name=None, record_name=None, details=None): item = dict(idnsname=record_name)