mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Cleaning up some of the notify/facts logic added earlier to fix problems
This commit is contained in:
parent
1aa4155266
commit
271a7f3281
4 changed files with 14 additions and 14 deletions
|
@ -131,16 +131,17 @@ class ResultProcess(multiprocessing.Process):
|
|||
|
||||
for result_item in result_items:
|
||||
# if this task is notifying a handler, do it now
|
||||
if 'ansible_notify' in result_item and result.is_changed():
|
||||
# The shared dictionary for notified handlers is a proxy, which
|
||||
# does not detect when sub-objects within the proxy are modified.
|
||||
# So, per the docs, we reassign the list so the proxy picks up and
|
||||
# notifies all other threads
|
||||
for notify in result_item['ansible_notify']:
|
||||
if result._task._role:
|
||||
role_name = result._task._role.get_name()
|
||||
notify = "%s : %s" % (role_name, notify)
|
||||
self._send_result(('notify_handler', result._host, notify))
|
||||
if 'ansible_notify' in result_item:
|
||||
if result.is_changed():
|
||||
# The shared dictionary for notified handlers is a proxy, which
|
||||
# does not detect when sub-objects within the proxy are modified.
|
||||
# So, per the docs, we reassign the list so the proxy picks up and
|
||||
# notifies all other threads
|
||||
for notify in result_item['ansible_notify']:
|
||||
if result._task._role:
|
||||
role_name = result._task._role.get_name()
|
||||
notify = "%s : %s" % (role_name, notify)
|
||||
self._send_result(('notify_handler', result._host, notify))
|
||||
# now remove the notify field from the results, as its no longer needed
|
||||
result_item.pop('ansible_notify')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue