Skip to content

Commit

Permalink
Fix syntax in rax_clb_nodes that breaks in Python3 (#4933)
Browse files Browse the repository at this point in the history
* Use syntax that works in both Python 2 and 3 when iterating through a
    dict that's going to be mutated during iteration
  * Fixes `dictionary changed size during iteration` error
  * Fixes #4932

(cherry picked from commit 9a928d5)
  • Loading branch information
tcaddy authored and patchback[bot] committed Jul 7, 2022
1 parent ab176ac commit 894fbe4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/4933-fix-rax-clb-nodes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- rax_clb_nodes - fix code to be compatible with Python 3 (https://github.com/ansible-collections/community.general/pull/4933).
3 changes: 2 additions & 1 deletion plugins/modules/cloud/rackspace/rax_clb_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ def main():
'weight': weight,
}

for name, value in mutable.items():
for name in list(mutable):
value = mutable[name]
if value is None or value == getattr(node, name):
mutable.pop(name)

Expand Down

0 comments on commit 894fbe4

Please sign in to comment.