mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 14:01:42 -07:00
Fixing bugs in play iteration and strategies
* Fixed a bug in PlayIterator when ITERATING_ALWAYS, where the block was advanced but the incorrect data structure elements were cleared * Cleaned up the logic of is_failed() in PlayIterator * Fixed a bug in the free strategy which had not been updated to use the base strategy _execute_meta() method * Stopped strategies from using is_failed() to determine if tasks should still be fetched for a host Fixes #14040
This commit is contained in:
parent
8039ceee0f
commit
699a854bf3
3 changed files with 16 additions and 25 deletions
|
@ -275,7 +275,7 @@ class PlayIterator:
|
|||
if state.pending_setup:
|
||||
state.pending_setup = False
|
||||
|
||||
if state.fail_state & self.FAILED_TASKS == self.FAILED_TASKS:
|
||||
if self._check_failed_state(state):
|
||||
state.run_state = self.ITERATING_RESCUE
|
||||
elif state.cur_regular_task >= len(block.block):
|
||||
state.run_state = self.ITERATING_ALWAYS
|
||||
|
@ -335,7 +335,9 @@ class PlayIterator:
|
|||
state.cur_rescue_task = 0
|
||||
state.cur_always_task = 0
|
||||
state.run_state = self.ITERATING_TASKS
|
||||
state.child_state = None
|
||||
state.tasks_child_state = None
|
||||
state.rescue_child_state = None
|
||||
state.always_child_state = None
|
||||
else:
|
||||
task = block.always[state.cur_always_task]
|
||||
if isinstance(task, Block) or state.always_child_state is not None:
|
||||
|
@ -365,7 +367,7 @@ class PlayIterator:
|
|||
return (state, task)
|
||||
|
||||
def _set_failed_state(self, state):
|
||||
if state.pending_setup:
|
||||
if state.run_state == self.ITERATING_SETUP:
|
||||
state.fail_state |= self.FAILED_SETUP
|
||||
state.run_state = self.ITERATING_COMPLETE
|
||||
elif state.run_state == self.ITERATING_TASKS:
|
||||
|
@ -407,19 +409,18 @@ class PlayIterator:
|
|||
def _check_failed_state(self, state):
|
||||
if state is None:
|
||||
return False
|
||||
elif state.fail_state != self.FAILED_NONE:
|
||||
if state.run_state == self.ITERATING_RESCUE and state.fail_state&self.FAILED_RESCUE == 0 or \
|
||||
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):
|
||||
return True
|
||||
elif state.run_state == self.ITERATING_RESCUE and self._check_failed_state(state.rescue_child_state):
|
||||
return True
|
||||
elif state.run_state == self.ITERATING_ALWAYS and self._check_failed_state(state.always_child_state):
|
||||
return True
|
||||
elif state.run_state == self.ITERATING_COMPLETE and 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
|
||||
return False
|
||||
|
||||
def is_failed(self, host):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue