1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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()
This commit is contained in:
kavink 2013-09-04 18:30:33 -07:00
parent fff497a1ae
commit a075ec9831

View file

@ -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