mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
nsupdate: fix 'index out of range' error when no TTL answer is given (#7219)
* nsupdate: fix 'index out of range' error when no TTL answer is given Fix a possible `list index out of range` when no answer is returned in the `ttl_changed` method by applying the existing workaround for NS records to all record types. Resolves #836 * fixup! nsupdate: fix 'index out of range' error when no TTL answer is given
This commit is contained in:
parent
afeeb89af6
commit
208df2c9e6
2 changed files with 4 additions and 4 deletions
2
changelogs/fragments/7219-fix-nsupdate-cname.yaml
Normal file
2
changelogs/fragments/7219-fix-nsupdate-cname.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- nsupdate - fix a possible ``list index out of range`` exception (https://github.com/ansible-collections/community.general/issues/836).
|
|
@ -467,10 +467,8 @@ class RecordManager(object):
|
||||||
if lookup.rcode() != dns.rcode.NOERROR:
|
if lookup.rcode() != dns.rcode.NOERROR:
|
||||||
self.module.fail_json(msg='Failed to lookup TTL of existing matching record.')
|
self.module.fail_json(msg='Failed to lookup TTL of existing matching record.')
|
||||||
|
|
||||||
if self.module.params['type'] == 'NS':
|
current_ttl = lookup.answer[0].ttl if lookup.answer else lookup.authority[0].ttl
|
||||||
current_ttl = lookup.answer[0].ttl if lookup.answer else lookup.authority[0].ttl
|
|
||||||
else:
|
|
||||||
current_ttl = lookup.answer[0].ttl
|
|
||||||
return current_ttl != self.module.params['ttl']
|
return current_ttl != self.module.params['ttl']
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue