From 42183e562ae8cb92eb79b0184f079787e54adefa Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Thu, 11 Oct 2018 00:01:17 +0530 Subject: [PATCH] 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 58aaf532716ca6b662fc015d694c108767d254bb) Update Changelog --- changelogs/fragments/netconf_module_utils_py3_fix.yaml | 3 +++ lib/ansible/module_utils/network/netconf/netconf.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/netconf_module_utils_py3_fix.yaml diff --git a/changelogs/fragments/netconf_module_utils_py3_fix.yaml b/changelogs/fragments/netconf_module_utils_py3_fix.yaml new file mode 100644 index 00000000000..cc8d8670a5f --- /dev/null +++ b/changelogs/fragments/netconf_module_utils_py3_fix.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- netconf_config - Fix netconf module_utils dict changed size issue (https://github.com/ansible/ansible/pull/46778) diff --git a/lib/ansible/module_utils/network/netconf/netconf.py b/lib/ansible/module_utils/network/netconf/netconf.py index cf25adc3bdb..f612142b60f 100644 --- a/lib/ansible/module_utils/network/netconf/netconf.py +++ b/lib/ansible/module_utils/network/netconf/netconf.py @@ -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()