Prevent duplicately loaded handlers from running more than once.

Fixes #3863
This commit is contained in:
Michael DeHaan 2013-10-07 17:15:19 -04:00
parent 5ed28efe45
commit f081c68a65

View file

@ -538,10 +538,14 @@ class PlayBook(object):
# here a meta task is a placeholder that signals handlers should be run # here a meta task is a placeholder that signals handlers should be run
if task.meta == 'flush_handlers': if task.meta == 'flush_handlers':
fired_names = {}
for handler in play.handlers(): for handler in play.handlers():
if len(handler.notified_by) > 0: if len(handler.notified_by) > 0:
self.inventory.restrict_to(handler.notified_by) self.inventory.restrict_to(handler.notified_by)
if handler.name not in fired_names:
self._run_task(play, handler, True) self._run_task(play, handler, True)
# prevent duplicate handler includes from running more than once
fired_names[handler.name] = 1
self.inventory.lift_restriction() self.inventory.lift_restriction()
new_list = handler.notified_by[:] new_list = handler.notified_by[:]
for host in handler.notified_by: for host in handler.notified_by: