Fix handlers on strategy free (#33011)

Add _flushed_hosts dict to store when handlers are flushed and prevent them
to be executed too early using _filter_notified_hosts.

Add _wait_on_handler_results to wait only for handlers to be completed.

Remove only hosts that have been flushed from handler notified list.

Fix #31504, #23970
This commit is contained in:
Pablo 2018-08-22 16:07:31 +02:00 committed by Brian Coca
parent ec2aa12581
commit 5f953d1129
2 changed files with 66 additions and 8 deletions

View file

@ -49,6 +49,15 @@ except ImportError:
class StrategyModule(StrategyBase):
def _filter_notified_hosts(self, notified_hosts):
'''
Filter notified hosts accordingly to strategy
'''
# We act only on hosts that are ready to flush handlers
return [host for host in notified_hosts
if host in self._flushed_hosts and self._flushed_hosts[host]]
def run(self, iterator, play_context):
'''
The "free" strategy is a bit more complex, in that it allows tasks to