Make sure run_once tasks also set any_errors_fatal so all hosts fail

Currently implemented only in the linear strategy (free strategy simply
ignores run_once/BYPASS_HOST_LOOP actions).

Fixes #14252
This commit is contained in:
James Cammarata 2016-02-05 10:58:24 -05:00
parent b713f1ca53
commit 27f9cc05f8

View file

@ -190,9 +190,6 @@ class StrategyModule(StrategyBase):
run_once = False run_once = False
work_to_do = True work_to_do = True
if task.any_errors_fatal:
any_errors_fatal = True
# test to see if the task across all hosts points to an action plugin which # test to see if the task across all hosts points to an action plugin which
# sets BYPASS_HOST_LOOP to true, or if it has run_once enabled. If so, we # sets BYPASS_HOST_LOOP to true, or if it has run_once enabled. If so, we
# will only send this task to the first host in the list. # will only send this task to the first host in the list.
@ -230,7 +227,10 @@ class StrategyModule(StrategyBase):
templar = Templar(loader=self._loader, variables=task_vars) templar = Templar(loader=self._loader, variables=task_vars)
display.debug("done getting variables") display.debug("done getting variables")
run_once = templar.template(task.run_once) run_once = templar.template(task.run_once) or getattr(action, 'BYPASS_HOST_LOOP', False)
if task.any_errors_fatal or run_once:
any_errors_fatal = True
if not callback_sent: if not callback_sent:
display.debug("sending task start callback, copying the task so we can template it temporarily") display.debug("sending task start callback, copying the task so we can template it temporarily")
@ -254,7 +254,7 @@ class StrategyModule(StrategyBase):
self._queue_task(host, task, task_vars, play_context) self._queue_task(host, task, task_vars, play_context)
# if we're bypassing the host loop, break out now # if we're bypassing the host loop, break out now
if run_once or getattr(action, 'BYPASS_HOST_LOOP', False): if run_once:
break break
results += self._process_pending_results(iterator, one_pass=True) results += self._process_pending_results(iterator, one_pass=True)