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)