_run_loop: Add the task name to the warning (#76012)

Prepend the task name to the warning "The loop variable 'item' is
already in use", so that you can get some context even if stdout and
stderr go to separate places.
This commit is contained in:
Yedidyah Bar David
2021-10-14 10:31:04 -04:00
committed by GitHub
parent 64506c7d15
commit aff5e5dfc6
2 changed files with 5 additions and 2 deletions
@@ -0,0 +1,3 @@
bugfixes:
- _run_loop - Add the task name to the warning
(https://github.com/ansible/ansible/issues/76011)
+2 -2
View File
@@ -293,9 +293,9 @@ class TaskExecutor:
label = '{{' + loop_var + '}}'
if loop_var in task_vars:
display.warning(u"The loop variable '%s' is already in use. "
display.warning(u"%s: The loop variable '%s' is already in use. "
u"You should set the `loop_var` value in the `loop_control` option for the task"
u" to something else to avoid variable collisions and unexpected behavior." % loop_var)
u" to something else to avoid variable collisions and unexpected behavior." % (self._task, loop_var))
ran_once = False