Skip to content

Commit

Permalink
Fix incorrect handling of any_errors_fatal in the linear strategy
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jimi-c committed Jan 20, 2016
1 parent e3a6acc commit ac89b0d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/ansible/plugins/strategy/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,20 @@ def run(self, iterator, play_context):
display.debug("results queue empty")

display.debug("checking for any_errors_fatal")
had_failure = include_failure
failed_hosts = []
for res in results:
if res.is_failed() or res.is_unreachable():
had_failure = True
break
if task and task.any_errors_fatal and had_failure:
return False
failed_hosts.append(res._host.name)

# if any_errors_fatal and we had an error, mark all hosts as failed
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:
display.debug("got IOError/EOFError in task loop: %s" % e)
Expand Down

0 comments on commit ac89b0d

Please sign in to comment.