_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.
pull/76070/head
Yedidyah Bar David 3 years ago committed by GitHub
parent 64506c7d15
commit aff5e5dfc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- _run_loop - Add the task name to the warning
(https://github.com/ansible/ansible/issues/76011)

@ -293,9 +293,9 @@ class TaskExecutor:
label = '{{' + loop_var + '}}' label = '{{' + loop_var + '}}'
if loop_var in task_vars: 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"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 ran_once = False

Loading…
Cancel
Save