summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2017-01-19 09:25:30 -0600
committerJames Cammarata <jimi@sngx.net>2017-01-19 09:25:30 -0600
commitc7574863d935ce89cba335c1fc660718711a5ba1 (patch)
tree987939d170984c006d664b42d0ba3b54a3251a48
parentbf3ab2dc3b328d1c2b0187f4ce7f4ac2936aa689 (diff)
downloadansible-fix_block_iteration_bug.tar.gz
Fixing iterator bug related to reworking of end-of-role detectionfix_block_iteration_bug
Bug was introduced in cae682607
-rw-r--r--lib/ansible/executor/play_iterator.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py
index 02052f56b3..1e7775d3e2 100644
--- a/lib/ansible/executor/play_iterator.py
+++ b/lib/ansible/executor/play_iterator.py
@@ -275,7 +275,7 @@ class PlayIterator:
return (s, task)
- def _get_next_task_from_state(self, state, host, peek):
+ def _get_next_task_from_state(self, state, host, peek, in_child=False):
task = None
@@ -341,7 +341,7 @@ class PlayIterator:
# have one recurse into it for the next task. If we're done with the child
# state, we clear it and drop back to geting the next task from the list.
if state.tasks_child_state:
- (state.tasks_child_state, task) = self._get_next_task_from_state(state.tasks_child_state, host=host, peek=peek)
+ (state.tasks_child_state, task) = self._get_next_task_from_state(state.tasks_child_state, host=host, peek=peek, in_child=True)
if self._check_failed_state(state.tasks_child_state):
# failed child state, so clear it and move into the rescue portion
state.tasks_child_state = None
@@ -379,7 +379,7 @@ class PlayIterator:
# The process here is identical to ITERATING_TASKS, except instead
# we move into the always portion of the block.
if state.rescue_child_state:
- (state.rescue_child_state, task) = self._get_next_task_from_state(state.rescue_child_state, host=host, peek=peek)
+ (state.rescue_child_state, task) = self._get_next_task_from_state(state.rescue_child_state, host=host, peek=peek, in_child=True)
if self._check_failed_state(state.rescue_child_state):
state.rescue_child_state = None
self._set_failed_state(state)
@@ -409,7 +409,7 @@ class PlayIterator:
# run state to ITERATING_COMPLETE in the event of any errors, or when we
# have hit the end of the list of blocks.
if state.always_child_state:
- (state.always_child_state, task) = self._get_next_task_from_state(state.always_child_state, host=host, peek=peek)
+ (state.always_child_state, task) = self._get_next_task_from_state(state.always_child_state, host=host, peek=peek, in_child=True)
if self._check_failed_state(state.always_child_state):
state.always_child_state = None
self._set_failed_state(state)
@@ -434,7 +434,7 @@ class PlayIterator:
# we're advancing blocks, so if this was an end-of-role block we
# mark the current role complete
- if block._eor and host.name in block._role._had_task_run:
+ if block._eor and host.name in block._role._had_task_run and not in_child:
block._role._completed[host.name] = True
else:
task = block.always[state.cur_always_task]