mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #7219/208df2c9 backport][stable-6] nsupdate: fix 'index out of range' error when no TTL answer is given (#7235)
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
(cherry picked from commit 208df2c9e6
)
Co-authored-by: Silke Hofstra <silkeh@users.noreply.github.com>
This commit is contained in:
parent
fae1dbc198
commit
2a5e4b8a46
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:
|
||||
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
|
||||
else:
|
||||
current_ttl = lookup.answer[0].ttl
|
||||
current_ttl = lookup.answer[0].ttl if lookup.answer else lookup.authority[0].ttl
|
||||
|
||||
return current_ttl != self.module.params['ttl']
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue