summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2016-01-06 14:01:35 -0500
committerJames Cammarata <jimi@sngx.net>2016-01-06 14:01:35 -0500
commitfcd074d40f32ef52ed286678293984125ff51008 (patch)
tree2f383991545c1ddd06fe510d3c910c0e6c510e9b
parent21775d7866c7953d4d953c271c0a18e227e4bc66 (diff)
parent93f37f5969685e6f566d1a03c427b01924c11038 (diff)
downloadansible-fcd074d40f32ef52ed286678293984125ff51008.tar.gz
Merge branch 'ktosiek-fix-playbook-hanging' into stable-2.0
-rw-r--r--lib/ansible/plugins/strategy/linear.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/ansible/plugins/strategy/linear.py b/lib/ansible/plugins/strategy/linear.py
index 7bb227dbae..383c069b3a 100644
--- a/lib/ansible/plugins/strategy/linear.py
+++ b/lib/ansible/plugins/strategy/linear.py
@@ -62,19 +62,26 @@ class StrategyModule(StrategyBase):
num_rescue = 0
num_always = 0
- lowest_cur_block = len(iterator._blocks)
-
display.debug("counting tasks in each state of execution")
- for (k, v) in iteritems(host_tasks):
- if v is None:
- continue
-
+ host_tasks_to_run = [(host, state_task)
+ for host, state_task in iteritems(host_tasks)
+ if state_task and state_task[1]]
+
+ if host_tasks_to_run:
+ lowest_cur_block = min(
+ (s.cur_block for h, (s, t) in host_tasks_to_run
+ if s.run_state != PlayIterator.ITERATING_COMPLETE))
+ else:
+ # empty host_tasks_to_run will just run till the end of the function
+ # without ever touching lowest_cur_block
+ lowest_cur_block = None
+
+ for (k, v) in host_tasks_to_run:
(s, t) = v
- if t is None:
- continue
- if s.cur_block < lowest_cur_block and s.run_state != PlayIterator.ITERATING_COMPLETE:
- lowest_cur_block = s.cur_block
+ if s.cur_block > lowest_cur_block:
+ # Not the current block, ignore it
+ continue
if s.run_state == PlayIterator.ITERATING_SETUP:
num_setups += 1