Clean up PlaybookExecutor logic for batches and errors
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
(cherry picked from commit 890e096b2b
)
This commit is contained in:
parent
fc3efdb057
commit
f80c981ef6
1 changed files with 7 additions and 10 deletions
|
@ -156,22 +156,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
|
||||
|
||||
|
|
Loading…
Reference in a new issue