cast/copy keys() to list to avoid py3 errors
In py3, dict.keys() is a view and not a copy of the dicts keys, so attempting to delete items from the dict while iterating over the keys results int RuntimeError: dictionary changed size during iteration Resolve by casting .keys() to a list() type.
This commit is contained in:
parent
9f673e0725
commit
2addc09050
1 changed files with 1 additions and 1 deletions
|
@ -114,7 +114,7 @@ class ActionModule(ActionBase):
|
||||||
# connection to the remote host
|
# connection to the remote host
|
||||||
if 'ansible_syslog_facility' in task_vars:
|
if 'ansible_syslog_facility' in task_vars:
|
||||||
del task_vars['ansible_syslog_facility']
|
del task_vars['ansible_syslog_facility']
|
||||||
for key in task_vars.keys():
|
for key in list(task_vars.keys()):
|
||||||
if key.startswith("ansible_") and key.endswith("_interpreter"):
|
if key.startswith("ansible_") and key.endswith("_interpreter"):
|
||||||
del task_vars[key]
|
del task_vars[key]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue