mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Fixing bugs related to nested blocks inside roles
* Make sure dep chains are checked recursively for nested blocks * Fixing iterator is_failed() check to make sure we're not in a rescue block before returning True * Use is_failed() to test whether a host should be added to the TQM failed_hosts list * Use is_failed() when compiling the list of hosts left to iterate over in both the linear and free strategies Fixes #14222
This commit is contained in:
parent
00f600bfc8
commit
275728e0f6
6 changed files with 46 additions and 28 deletions
|
@ -210,8 +210,10 @@ class StrategyBase:
|
|||
[iterator.mark_host_failed(h) for h in self._inventory.get_hosts(iterator._play.hosts) if h.name not in self._tqm._unreachable_hosts]
|
||||
else:
|
||||
iterator.mark_host_failed(host)
|
||||
(state, tmp_task) = iterator.get_next_task_for_host(host, peek=True)
|
||||
if not state or state.run_state != PlayIterator.ITERATING_RESCUE:
|
||||
|
||||
# only add the host to the failed list officially if it has
|
||||
# been failed by the iterator
|
||||
if iterator.is_failed(host):
|
||||
self._tqm._failed_hosts[host.name] = True
|
||||
self._tqm._stats.increment('failures', host.name)
|
||||
else:
|
||||
|
|
|
@ -58,7 +58,7 @@ class StrategyModule(StrategyBase):
|
|||
work_to_do = True
|
||||
while work_to_do and not self._tqm._terminated:
|
||||
|
||||
hosts_left = [host for host in self._inventory.get_hosts(iterator._play.hosts) if host.name not in self._tqm._unreachable_hosts]
|
||||
hosts_left = [host for host in self._inventory.get_hosts(iterator._play.hosts) if host.name not in self._tqm._unreachable_hosts and not iterator.is_failed(host)]
|
||||
if len(hosts_left) == 0:
|
||||
self._tqm.send_callback('v2_playbook_on_no_hosts_remaining')
|
||||
result = False
|
||||
|
|
|
@ -162,7 +162,7 @@ class StrategyModule(StrategyBase):
|
|||
|
||||
try:
|
||||
display.debug("getting the remaining hosts for this loop")
|
||||
hosts_left = [host for host in self._inventory.get_hosts(iterator._play.hosts) if host.name not in self._tqm._unreachable_hosts]
|
||||
hosts_left = [host for host in self._inventory.get_hosts(iterator._play.hosts) if host.name not in self._tqm._unreachable_hosts and not iterator.is_failed(host)]
|
||||
display.debug("done getting the remaining hosts for this loop")
|
||||
|
||||
# queue up this task for each host in the inventory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue