From 5b3b9ba2670cd308d03ffd3708b8fb7213288bf5 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Fri, 21 Mar 2014 13:31:47 -0400 Subject: [PATCH] Addresses #4407 Caculate failed percentage based on serial and number of hosts in play --- lib/ansible/playbook/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 88dd0f5f4bc..ce17303bbce 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -674,8 +674,14 @@ class PlayBook(object): play.max_fail_pct = 0 # If threshold for max nodes failed is exceeded , bail out. - if (hosts_count - len(host_list)) > int((play.max_fail_pct)/100.0 * hosts_count): - host_list = None + if play.serial > 0: + # if serial is set, we need to shorten the size of host_count + play_count = len(play._play_hosts) + if (play_count - len(host_list)) > int((play.max_fail_pct)/100.0 * play_count): + host_list = None + else: + if (hosts_count - len(host_list)) > int((play.max_fail_pct)/100.0 * hosts_count): + host_list = None # if no hosts remain, drop out if not host_list: