From 485ebaa799ebd61d1f1759a897ca2fbe373dc96b Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 10 Jun 2019 15:21:15 -0700 Subject: [PATCH] [stable-2.8] Fix RuntimeError on Python 3.8. (#57520) * [stable-2.8] Fix RuntimeError on Python 3.8. (cherry picked from commit b9a0086aac8d710fb69eced37f64710a437874ec) Co-authored-by: Matt Clay * Add changelog fragment. --- changelogs/fragments/runtime-error-3.8.yaml | 3 +++ lib/ansible/modules/network/dellos9/dellos9_facts.py | 4 ++-- lib/ansible/modules/storage/netapp/na_ontap_quotas.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/runtime-error-3.8.yaml diff --git a/changelogs/fragments/runtime-error-3.8.yaml b/changelogs/fragments/runtime-error-3.8.yaml new file mode 100644 index 00000000000..4adf4e19a38 --- /dev/null +++ b/changelogs/fragments/runtime-error-3.8.yaml @@ -0,0 +1,3 @@ +bugfixes: + - dellos9_facts - Fix RuntimeError on Python 3.8. + - na_ontap_quotas - Fix RuntimeError on Python 3.8. diff --git a/lib/ansible/modules/network/dellos9/dellos9_facts.py b/lib/ansible/modules/network/dellos9/dellos9_facts.py index b7abedf5527..5818644430b 100644 --- a/lib/ansible/modules/network/dellos9/dellos9_facts.py +++ b/lib/ansible/modules/network/dellos9/dellos9_facts.py @@ -252,13 +252,13 @@ class Interfaces(FactsBase): data = self.responses[0] interfaces = self.parse_interfaces(data) - for key in interfaces.keys(): + for key in list(interfaces.keys()): if "ManagementEthernet" in key: temp_parsed = interfaces[key] del interfaces[key] interfaces.update(self.parse_mgmt_interfaces(temp_parsed)) - for key in interfaces.keys(): + for key in list(interfaces.keys()): if "Vlan" in key: temp_parsed = interfaces[key] del interfaces[key] diff --git a/lib/ansible/modules/storage/netapp/na_ontap_quotas.py b/lib/ansible/modules/storage/netapp/na_ontap_quotas.py index 7ecb904ed9d..7957331e2ee 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_quotas.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_quotas.py @@ -326,7 +326,7 @@ class NetAppONTAPQuotas(object): elif cd_action == 'delete': self.quota_entry_delete() elif modify_quota is not None: - for key in modify_quota: + for key in list(modify_quota): modify_quota[key.replace("_", "-")] = modify_quota.pop(key) self.quota_entry_modify(modify_quota) if modify_quota_status is not None: