diff options
author | James Cammarata <jimi@sngx.net> | 2016-08-18 13:52:34 -0500 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2016-08-18 13:52:34 -0500 |
commit | 890e096b2b3b9bf71d8ba85d92dc1419aa12477a (patch) | |
tree | 19d2e442deeaa96f6b726e0a19f947d584b6af11 | |
parent | 677a34a191b7e5cde815ce36737fcada222f20c4 (diff) | |
download | ansible-issue_15954.tar.gz |
Clean up PlaybookExecutor logic for batches and errorsissue_15954
The calculation for max_fail_percentage was moved into the linear
strategy a while back, and works better there in the stategy layer
rather than at the PBE layer. This patch removes it from the PBE layer
and tweaks the logic controlling whether or not the next batch is run.
Fixes #15954
-rw-r--r-- | lib/ansible/executor/playbook_executor.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/ansible/executor/playbook_executor.py b/lib/ansible/executor/playbook_executor.py index 03a551fb40..3d6d54cbe2 100644 --- a/lib/ansible/executor/playbook_executor.py +++ b/lib/ansible/executor/playbook_executor.py @@ -157,22 +157,19 @@ class PlaybookExecutor: # batch failed failed_hosts_count = len(self._tqm._failed_hosts) + len(self._tqm._unreachable_hosts) - \ (previously_failed + previously_unreachable) - if new_play.max_fail_percentage is not None and \ - int((new_play.max_fail_percentage)/100.0 * len(batch)) > int((len(batch) - failed_hosts_count) / len(batch) * 100.0): - break_play = True - break - elif len(batch) == failed_hosts_count: + + if len(batch) == failed_hosts_count: break_play = True break + # update the previous counts so they don't accumulate incorrectly + # over multiple serial batches + previously_failed += len(self._tqm._failed_hosts) - previously_failed + previously_unreachable += len(self._tqm._unreachable_hosts) - previously_unreachable + # save the unreachable hosts from this batch self._unreachable_hosts.update(self._tqm._unreachable_hosts) - # if the last result wasn't zero or 3 (some hosts were unreachable), - # break out of the serial batch loop - if result not in (self._tqm.RUN_OK, self._tqm.RUN_UNREACHABLE_HOSTS): - break - if break_play: break |