From f5de633197edd2393d1dcdc021101aa2685aeacc Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 25 Apr 2019 14:23:06 -0500 Subject: [PATCH] Be sure to use the active state when checking for any_errors_fatal The current code was not properly checking for the active state when checking any_errors_fatal, so if the error occurred in a sub-block or included file it is not properly detected. Fixes #55515 --- .../fragments/55515-use-active-state-for-any_errors_fatal.yaml | 2 ++ lib/ansible/plugins/strategy/linear.py | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 changelogs/fragments/55515-use-active-state-for-any_errors_fatal.yaml diff --git a/changelogs/fragments/55515-use-active-state-for-any_errors_fatal.yaml b/changelogs/fragments/55515-use-active-state-for-any_errors_fatal.yaml new file mode 100644 index 00000000000..b7c603f35a0 --- /dev/null +++ b/changelogs/fragments/55515-use-active-state-for-any_errors_fatal.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Be sure to use the active state when checking for any_errors_fatal diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py index 0a1c11c268c..34960323299 100644 --- a/lib/ansible/plugins/strategy/linear.py +++ b/lib/ansible/plugins/strategy/linear.py @@ -409,6 +409,9 @@ class StrategyModule(StrategyBase): dont_fail_states = frozenset([iterator.ITERATING_RESCUE, iterator.ITERATING_ALWAYS]) for host in hosts_left: (s, _) = iterator.get_next_task_for_host(host, peek=True) + # the state may actually be in a child state, use the get_active_state() + # method in the iterator to figure out the true active state + s = iterator.get_active_state(s) if s.run_state not in dont_fail_states or \ s.run_state == iterator.ITERATING_RESCUE and s.fail_state & iterator.FAILED_RESCUE != 0: self._tqm._failed_hosts[host.name] = True