mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix unreachable host/any_errors_fatal bug in linear strategy
2e003adb added the ability for tasks using any_errors_fatal to fail when there were unreachable hosts. However that patch used the running unreachable hosts data rather than the results from the current task, which causes failures when any run_once or BYPASS_HOST_LOOP task is hit after an unreachable host causes a failure. This patch corrects that by using the current set of results to determine if any hosts were unreachable during the last task only. Fixes ansible/ansible-modules-core#4160
This commit is contained in:
parent
de549ad675
commit
245ce9461d
1 changed files with 4 additions and 1 deletions
|
@ -349,12 +349,15 @@ class StrategyModule(StrategyBase):
|
|||
|
||||
display.debug("checking for any_errors_fatal")
|
||||
failed_hosts = []
|
||||
unreachable_hosts = []
|
||||
for res in results:
|
||||
if res.is_failed():
|
||||
failed_hosts.append(res._host.name)
|
||||
elif res.is_unreachable():
|
||||
unreachable_hosts.append(res._host.name)
|
||||
|
||||
# if any_errors_fatal and we had an error, mark all hosts as failed
|
||||
if any_errors_fatal and (len(failed_hosts) > 0 or len(self._tqm._unreachable_hosts.keys()) > 0):
|
||||
if any_errors_fatal and (len(failed_hosts) > 0 or len(unreachable_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
|
||||
|
|
Loading…
Reference in a new issue