From 614c626ed0b7fb7913904cfe26dc001022a35d38 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 7 Jul 2015 14:19:49 -0400 Subject: [PATCH] Fix no hosts remaining logic in linear strategy --- lib/ansible/plugins/strategies/linear.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ansible/plugins/strategies/linear.py b/lib/ansible/plugins/strategies/linear.py index 70ab50d8eac..3d14f2d49b4 100644 --- a/lib/ansible/plugins/strategies/linear.py +++ b/lib/ansible/plugins/strategies/linear.py @@ -130,14 +130,8 @@ class StrategyModule(StrategyBase): try: debug("getting the remaining hosts for this loop") - self._tqm._failed_hosts = iterator.get_failed_hosts() - hosts_left = self.get_hosts_remaining(iterator._play) + hosts_left = self._inventory.get_hosts(iterator._play.hosts) 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 callback_sent = False @@ -145,6 +139,7 @@ class StrategyModule(StrategyBase): host_results = [] host_tasks = self._get_next_task_lockstep(hosts_left, iterator) + for (host, task) in host_tasks: if not task: continue @@ -208,6 +203,12 @@ class StrategyModule(StrategyBase): if run_once: 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") results = self._wait_on_pending_results(iterator) host_results.extend(results)