Fix netconf module_utils dict changed size issue (#46778)

Fixes #46755

Use list() to copy the keys of attribute dict
while iterating over attribute dict.

(cherry picked from commit 58aaf53271)

Update Changelog
This commit is contained in:
Ganesh Nalawade 2018-10-11 00:01:17 +05:30 committed by Toshio Kuratomi
parent c888058973
commit 42183e562a
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- netconf_config - Fix netconf module_utils dict changed size issue (https://github.com/ansible/ansible/pull/46778)

View file

@ -131,7 +131,7 @@ def sanitize_xml(data):
# remove attributes
attribute = element.attrib
if attribute:
for key in attribute:
for key in list(attribute):
if key not in IGNORE_XML_ATTRIBUTE:
attribute.pop(key)
return to_text(tostring(tree), errors='surrogate_then_replace').strip()