Fix no hosts remaining logic in linear strategy

pull/9432/head^2
James Cammarata 9 years ago
parent 135fa41e3a
commit 614c626ed0

@ -130,14 +130,8 @@ class StrategyModule(StrategyBase):
try: try:
debug("getting the remaining hosts for this loop") debug("getting the remaining hosts for this loop")
self._tqm._failed_hosts = iterator.get_failed_hosts() hosts_left = self._inventory.get_hosts(iterator._play.hosts)
hosts_left = self.get_hosts_remaining(iterator._play)
debug("done getting the remaining hosts for this loop") debug("done getting the remaining hosts for this loop")
if len(hosts_left) == 0:
debug("out of hosts to run on")
self._tqm.send_callback('v2_playbook_on_no_hosts_remaining')
result = False
break
# queue up this task for each host in the inventory # queue up this task for each host in the inventory
callback_sent = False callback_sent = False
@ -145,6 +139,7 @@ class StrategyModule(StrategyBase):
host_results = [] host_results = []
host_tasks = self._get_next_task_lockstep(hosts_left, iterator) host_tasks = self._get_next_task_lockstep(hosts_left, iterator)
for (host, task) in host_tasks: for (host, task) in host_tasks:
if not task: if not task:
continue continue
@ -208,6 +203,12 @@ class StrategyModule(StrategyBase):
if run_once: if run_once:
break break
if not work_to_do:
debug("out of hosts to run on")
self._tqm.send_callback('v2_playbook_on_no_hosts_remaining')
result = False
break
debug("done queuing things up, now waiting for results queue to drain") debug("done queuing things up, now waiting for results queue to drain")
results = self._wait_on_pending_results(iterator) results = self._wait_on_pending_results(iterator)
host_results.extend(results) host_results.extend(results)

Loading…
Cancel
Save