Take ITERATING_ALWAYS into account when setting failed state in PlayIterator

Fixes #15963

(cherry picked from commit 4dc2bf4815)
This commit is contained in:
James Cammarata 2016-09-20 11:10:27 -05:00
parent efe5bb122e
commit c004ae578d
2 changed files with 8 additions and 3 deletions

View file

@ -480,6 +480,8 @@ class PlayIterator:
elif state.fail_state != self.FAILED_NONE:
if state.run_state == self.ITERATING_RESCUE and state.fail_state&self.FAILED_RESCUE == 0:
return False
elif state.run_state == self.ITERATING_ALWAYS and state.fail_state&self.FAILED_ALWAYS == 0:
return False
else:
return True
elif state.run_state == self.ITERATING_TASKS and self._check_failed_state(state.tasks_child_state):

View file

@ -69,9 +69,12 @@ class StrategyModule(StrategyBase):
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))
try:
lowest_cur_block = min(
(s.cur_block for h, (s, t) in host_tasks_to_run
if s.run_state != PlayIterator.ITERATING_COMPLETE))
except ValueError:
lowest_cur_block = None
else:
# empty host_tasks_to_run will just run till the end of the function
# without ever touching lowest_cur_block