1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-18 18:01:31 +00:00

[PR #11717/b2cd1b55 backport][stable-12] Fix KeyError for 'dnsttl' (#11736)

Fix KeyError for 'dnsttl' (#11717)

* Fix KeyError for 'dnsttl'

I did not further dig into the code. However, since upgrading to the latest version of `community.general`, ansible fails with a weird error message "dnsttl" at a task where `community.general.ipa_dnsrecord` is called. After digging into the code a bit, I found out that it is a KeyError and caused by this line of code. I'm not sure, if it is safe to skip that line and not to set `result["dnsttl"]`.

* Add changelog fragment

* Adopt suggestion for changelogs/fragments/11717-fix-error-dnsttl.yml



---------


(cherry picked from commit b2cd1b555e)

Co-authored-by: sedrubal <sedrubal@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2026-04-04 18:44:05 +00:00 committed by GitHub
parent 6020893160
commit f00f70f849
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ipa_dnsrecord - fix errors when module is used with existing record with default TTL (https://github.com/ansible-collections/community.general/pull/11717).

View file

@ -210,7 +210,8 @@ class DNSRecordIPAClient(IPAClient):
else:
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"]]
if "dnsttl" in result:
result["dnsttl"] = [int(v) for v in result["dnsttl"]]
return result
def dnsrecord_add(self, zone_name=None, record_name=None, details=None):