mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #8614/9dd2b71d backport][stable-9] nsupdate: fix 'index out of range' error when changing NS records (#8630)
nsupdate: fix 'index out of range' error when changing NS records (#8614)
* nsupdate: fix 'index out of range' error when changing NS records
* add clog fragment
* Update changelogs/fragments/8614-nsupdate-index-out-of-range.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 9dd2b71d04
)
Co-authored-by: Art Win <art@make.lv>
This commit is contained in:
parent
37308c929b
commit
3b74e9b646
2 changed files with 4 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "nsupdate - fix 'index out of range' error when changing NS records by falling back to authority section of the response (https://github.com/ansible-collections/community.general/issues/8612, https://github.com/ansible-collections/community.general/pull/8614)."
|
|
@ -370,7 +370,8 @@ class RecordManager(object):
|
||||||
except (socket_error, dns.exception.Timeout) as e:
|
except (socket_error, dns.exception.Timeout) as e:
|
||||||
self.module.fail_json(msg='DNS server error: (%s): %s' % (e.__class__.__name__, to_native(e)))
|
self.module.fail_json(msg='DNS server error: (%s): %s' % (e.__class__.__name__, to_native(e)))
|
||||||
|
|
||||||
entries_to_remove = [n.to_text() for n in lookup.answer[0].items if n.to_text() not in self.value]
|
lookup_result = lookup.answer[0] if lookup.answer else lookup.authority[0]
|
||||||
|
entries_to_remove = [n.to_text() for n in lookup_result.items if n.to_text() not in self.value]
|
||||||
else:
|
else:
|
||||||
update.delete(self.module.params['record'], self.module.params['type'])
|
update.delete(self.module.params['record'], self.module.params['type'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue