Fix incorrect handling of any_errors_fatal in the linear strategy
Instead of bombing out of the strategy, we now properly mark hosts failed so that the play iterator can handle block rescue/always properly. Fixes #14024
This commit is contained in:
parent
e3a6accc1d
commit
ac89b0de7a
1 changed files with 12 additions and 5 deletions
|
@ -342,13 +342,20 @@ class StrategyModule(StrategyBase):
|
||||||
display.debug("results queue empty")
|
display.debug("results queue empty")
|
||||||
|
|
||||||
display.debug("checking for any_errors_fatal")
|
display.debug("checking for any_errors_fatal")
|
||||||
had_failure = include_failure
|
failed_hosts = []
|
||||||
for res in results:
|
for res in results:
|
||||||
if res.is_failed() or res.is_unreachable():
|
if res.is_failed() or res.is_unreachable():
|
||||||
had_failure = True
|
failed_hosts.append(res._host.name)
|
||||||
break
|
|
||||||
if task and task.any_errors_fatal and had_failure:
|
# if any_errors_fatal and we had an error, mark all hosts as failed
|
||||||
return False
|
if task and task.any_errors_fatal and len(failed_hosts) > 0:
|
||||||
|
for host in hosts_left:
|
||||||
|
# don't double-mark hosts, or the iterator will potentially
|
||||||
|
# fail them out of the rescue/always states
|
||||||
|
if host.name not in failed_hosts:
|
||||||
|
self._tqm._failed_hosts[host.name] = True
|
||||||
|
iterator.mark_host_failed(host)
|
||||||
|
display.debug("done checking for any_errors_fatal")
|
||||||
|
|
||||||
except (IOError, EOFError) as e:
|
except (IOError, EOFError) as e:
|
||||||
display.debug("got IOError/EOFError in task loop: %s" % e)
|
display.debug("got IOError/EOFError in task loop: %s" % e)
|
||||||
|
|
Loading…
Reference in a new issue