diff options
author | James Tanner <tanner.jc@gmail.com> | 2013-11-12 14:36:46 -0500 |
---|---|---|
committer | James Tanner <tanner.jc@gmail.com> | 2013-11-12 14:37:07 -0500 |
commit | dc41bb8085317a257305461e5ba6c85a470eb45f (patch) | |
tree | 7c1f81e9fc1cde2c08da4514e13e7a2b8e60a35c /lib/ansible/playbook | |
parent | f0afb20cebf7eb46e6d8a6602f0f62113c060263 (diff) | |
download | ansible-dc41bb8085317a257305461e5ba6c85a470eb45f.tar.gz |
Merge pull request #4207 from ashorin/ansible
Fail playbook when serial is set and hadlers fail on set.
Diffstat (limited to 'lib/ansible/playbook')
-rw-r--r-- | lib/ansible/playbook/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 0d82deb0ef..36788f2409 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -544,12 +544,23 @@ class PlayBook(object): for handler in play.handlers(): if len(handler.notified_by) > 0: self.inventory.restrict_to(handler.notified_by) + # Resolve the variables first handler_name = template(play.basedir, handler.name, handler.module_vars) if handler_name not in fired_names: self._run_task(play, handler, True) # prevent duplicate handler includes from running more than once 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() new_list = handler.notified_by[:] for host in handler.notified_by: |