1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix syntax in rax_clb_nodes that breaks in Python3 (#4933)

* 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
This commit is contained in:
Teddy Caddy 2022-07-07 15:49:45 -04:00 committed by GitHub
parent 905f9ec399
commit 9a928d5ffb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -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).

View file

@ -252,7 +252,8 @@ def main():
'weight': weight, '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): if value is None or value == getattr(node, name):
mutable.pop(name) mutable.pop(name)