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.
This commit is contained in:
Ganesh Nalawade 2018-10-11 00:01:17 +05:30 committed by GitHub
parent 32397531d0
commit 58aaf53271
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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