diff options
author | James Cammarata <jimi@sngx.net> | 2016-06-21 16:42:15 -0500 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2016-06-21 16:47:38 -0500 |
commit | 4c1601e9f245cda42e5c41237189d2a039e2f525 (patch) | |
tree | c966b864640c3a2dd0bf225f3e67d1d791a4962d | |
parent | aefa12a20f30597cf37d851f0f5f44a181b663ae (diff) | |
download | ansible-4c1601e9f245cda42e5c41237189d2a039e2f525.tar.gz |
Take previously failed/unreachable hosts into account when checking the batch
Again, as we're carrying failed/unreachable hosts forward from play to play via
internal structures, we need to remember which ones had previously failed so that
unrelated host failures don't inflate the numbers for a given serial batch in the
PlaybookExecutor causing a premature exit.
Fixes #16364
-rw-r--r-- | lib/ansible/executor/playbook_executor.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ansible/executor/playbook_executor.py b/lib/ansible/executor/playbook_executor.py index fed9ba5d52..826fc9146d 100644 --- a/lib/ansible/executor/playbook_executor.py +++ b/lib/ansible/executor/playbook_executor.py @@ -129,6 +129,9 @@ class PlaybookExecutor: else: self._tqm._unreachable_hosts.update(self._unreachable_hosts) + previously_failed = len(self._tqm._failed_hosts) + previously_unreachable = len(self._tqm._unreachable_hosts) + break_play = False # we are actually running plays for batch in self._get_serialized_batches(new_play): @@ -151,7 +154,8 @@ class PlaybookExecutor: # failure percentage allowed, or if any errors are fatal. If either of those # conditions are met, we break out, otherwise we only break out if the entire # batch failed - failed_hosts_count = len(self._tqm._failed_hosts) + len(self._tqm._unreachable_hosts) + 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 |