Make sure that serial failures are handled correctly.

This commit is contained in:
Vincent Roy 2016-04-15 22:59:54 -03:00 committed by James Cammarata
parent 5e9b13cb94
commit b0259a8631

View file

@ -128,6 +128,7 @@ class PlaybookExecutor:
else: else:
self._tqm._unreachable_hosts.update(self._unreachable_hosts) self._tqm._unreachable_hosts.update(self._unreachable_hosts)
break_play = False
# we are actually running plays # we are actually running plays
for batch in self._get_serialized_batches(new_play): for batch in self._get_serialized_batches(new_play):
if len(batch) == 0: if len(batch) == 0:
@ -147,8 +148,10 @@ class PlaybookExecutor:
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)
if new_play.max_fail_percentage is not None and \ 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): int((new_play.max_fail_percentage)/100.0 * len(batch)) > int((len(batch) - failed_hosts_count) / len(batch) * 100.0):
break_play = True
break break
elif len(batch) == failed_hosts_count: elif len(batch) == failed_hosts_count:
break_play = True
break break
# save the unreachable hosts from this batch # save the unreachable hosts from this batch
@ -159,6 +162,9 @@ class PlaybookExecutor:
if result not in (0, 3): if result not in (0, 3):
break break
if break_play:
break
i = i + 1 # per play i = i + 1 # per play
if entry: if entry: