mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #4207 from ashorin/ansible
Fail playbook when serial is set and hadlers fail on set.
This commit is contained in:
parent
f0afb20ceb
commit
dc41bb8085
1 changed files with 11 additions and 0 deletions
|
@ -544,12 +544,23 @@ class PlayBook(object):
|
||||||
for handler in play.handlers():
|
for handler in play.handlers():
|
||||||
if len(handler.notified_by) > 0:
|
if len(handler.notified_by) > 0:
|
||||||
self.inventory.restrict_to(handler.notified_by)
|
self.inventory.restrict_to(handler.notified_by)
|
||||||
|
|
||||||
# Resolve the variables first
|
# Resolve the variables first
|
||||||
handler_name = template(play.basedir, handler.name, handler.module_vars)
|
handler_name = template(play.basedir, handler.name, handler.module_vars)
|
||||||
if handler_name not in fired_names:
|
if handler_name not in fired_names:
|
||||||
self._run_task(play, handler, True)
|
self._run_task(play, handler, True)
|
||||||
# prevent duplicate handler includes from running more than once
|
# prevent duplicate handler includes from running more than once
|
||||||
fired_names[handler_name] = 1
|
fired_names[handler_name] = 1
|
||||||
|
|
||||||
|
host_list = self._list_available_hosts(play.hosts)
|
||||||
|
if handler.any_errors_fatal and len(host_list) < hosts_count:
|
||||||
|
play.max_fail_pct = 0
|
||||||
|
if (hosts_count - len(host_list)) > int((play.max_fail_pct)/100.0 * hosts_count):
|
||||||
|
host_list = None
|
||||||
|
if not host_list:
|
||||||
|
self.callbacks.on_no_hosts_remaining()
|
||||||
|
return False
|
||||||
|
|
||||||
self.inventory.lift_restriction()
|
self.inventory.lift_restriction()
|
||||||
new_list = handler.notified_by[:]
|
new_list = handler.notified_by[:]
|
||||||
for host in handler.notified_by:
|
for host in handler.notified_by:
|
||||||
|
|
Loading…
Reference in a new issue