Sanitize debug var= tasks of the loop variable

pull/66269/head
AlanCoding 5 years ago committed by Alan Rominger
parent 3740d7b028
commit 5c171c1b95
No known key found for this signature in database
GPG Key ID: C2D7EAAA12B63559

@ -0,0 +1,2 @@
bugfixes:
- "Fixed it so that debug tasks using var option will no longer show loop control variables."

@ -269,6 +269,11 @@ class CallbackBase(AnsiblePlugin):
# 'var' value as field, so eliminate others and what is left should be varname
for hidme in self._hide_in_debug:
result.pop(hidme, None)
# when using loop control, remove these vars in addition to the var they reference
for control_var in ('ansible_loop_var', 'ansible_index_var'):
if control_var in result:
loop_var = result.pop(control_var)
result.pop(loop_var, None)
def _print_task_path(self, task, color=C.COLOR_DEBUG):
path = task.get_path()

Loading…
Cancel
Save