mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Don't clear start at task flag until all hosts are advanced
Clearing the flag after the first host was advanced caused all other hosts to not advance at all. Fixes #13864
This commit is contained in:
parent
d09c9f526b
commit
1f7492171e
1 changed files with 28 additions and 23 deletions
|
@ -137,6 +137,7 @@ class PlayIterator:
|
||||||
self._blocks.append(new_block)
|
self._blocks.append(new_block)
|
||||||
|
|
||||||
self._host_states = {}
|
self._host_states = {}
|
||||||
|
start_at_matched = False
|
||||||
for host in inventory.get_hosts(self._play.hosts):
|
for host in inventory.get_hosts(self._play.hosts):
|
||||||
self._host_states[host.name] = HostState(blocks=self._blocks)
|
self._host_states[host.name] = HostState(blocks=self._blocks)
|
||||||
# if the host's name is in the variable manager's fact cache, then set
|
# if the host's name is in the variable manager's fact cache, then set
|
||||||
|
@ -152,15 +153,19 @@ class PlayIterator:
|
||||||
break
|
break
|
||||||
if task.name == play_context.start_at_task or fnmatch.fnmatch(task.name, play_context.start_at_task) or \
|
if task.name == play_context.start_at_task or fnmatch.fnmatch(task.name, play_context.start_at_task) or \
|
||||||
task.get_name() == play_context.start_at_task or fnmatch.fnmatch(task.get_name(), play_context.start_at_task):
|
task.get_name() == play_context.start_at_task or fnmatch.fnmatch(task.get_name(), play_context.start_at_task):
|
||||||
|
start_at_matched = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self.get_next_task_for_host(host)
|
||||||
|
|
||||||
|
# finally, reset the host's state to ITERATING_SETUP
|
||||||
|
self._host_states[host.name].run_state = self.ITERATING_SETUP
|
||||||
|
|
||||||
|
if start_at_matched:
|
||||||
# we have our match, so clear the start_at_task field on the
|
# we have our match, so clear the start_at_task field on the
|
||||||
# play context to flag that we've started at a task (and future
|
# play context to flag that we've started at a task (and future
|
||||||
# plays won't try to advance)
|
# plays won't try to advance)
|
||||||
play_context.start_at_task = None
|
play_context.start_at_task = None
|
||||||
break
|
|
||||||
else:
|
|
||||||
self.get_next_task_for_host(host)
|
|
||||||
# finally, reset the host's state to ITERATING_SETUP
|
|
||||||
self._host_states[host.name].run_state = self.ITERATING_SETUP
|
|
||||||
|
|
||||||
# Extend the play handlers list to include the handlers defined in roles
|
# Extend the play handlers list to include the handlers defined in roles
|
||||||
self._play.handlers.extend(play.compile_roles_handlers())
|
self._play.handlers.extend(play.compile_roles_handlers())
|
||||||
|
|
Loading…
Reference in a new issue