diff options
author | kavink <kavin@aerospike.com> | 2013-09-04 18:30:33 -0700 |
---|---|---|
committer | kavink <kavin@aerospike.com> | 2013-09-04 18:30:33 -0700 |
commit | a075ec9831ba1096af41c1d8d20eaf1b8e2909f7 (patch) | |
tree | f4380ef8d60803c7fb56f395bba5702bb132b9d8 | |
parent | fff497a1aef6db7f2a8f92d981a6b9a789bf798e (diff) | |
download | ansible-a075ec9831ba1096af41c1d8d20eaf1b8e2909f7.tar.gz |
Bug fix for a crash, when any_errors_fatal is true
Reported by Rumen:
TASK: [fail FAIL] *************************************************************
skipping: [hostname.com]
failed: [hostname.com] => {"failed": true}
msg: Failed as requested from task
Traceback (most recent call last):
File "/usr/local/bin/ansible-playbook", line 268, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/local/bin/ansible-playbook", line 208, in main
pb.run()
File "/Library/Python/2.7/site-packages/ansible/playbook/__init__.py", line 262, in run
if not self._run_play(play):
File "/Library/Python/2.7/site-packages/ansible/playbook/__init__.py", line 580, in _run_play
if (hosts_count - len(host_list)) > int((play.max_fail_pct)/100.0 * hosts_count):
TypeError: object of type 'NoneType' has no len()
-rw-r--r-- | lib/ansible/playbook/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 63d5934fd3..0ad9a65c0c 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -573,11 +573,11 @@ class PlayBook(object): host_list = self._list_available_hosts(play.hosts) - if task.any_errors_fatal and len(host_list) < hosts_count: - host_list = None - - # 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): + # If threshold for max nodes failed is exceeded or if any_errors_fatal is true, bail out. + if ( + (task.any_errors_fatal and len(host_list) < hosts_count) or + ((hosts_count - len(host_list)) > int((play.max_fail_pct)/100.0 * hosts_count)) + ): host_list = None # if no hosts remain, drop out |