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,7 +131,8 @@ class ResultProcess(multiprocessing.Process):
|
||||||
|
|
||||||
for result_item in result_items:
|
for result_item in result_items:
|
||||||
# if this task is notifying a handler, do it now
|
# if this task is notifying a handler, do it now
|
||||||
if 'ansible_notify' in result_item and result.is_changed():
|
if 'ansible_notify' in result_item:
|
||||||
|
if result.is_changed():
|
||||||
# The shared dictionary for notified handlers is a proxy, which
|
# The shared dictionary for notified handlers is a proxy, which
|
||||||
# does not detect when sub-objects within the proxy are modified.
|
# 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
|
# So, per the docs, we reassign the list so the proxy picks up and
|
||||||
|
|
|
@ -333,7 +333,7 @@ class TaskExecutor:
|
||||||
# save the notification target in the result, if it was specified, as
|
# save the notification target in the result, if it was specified, as
|
||||||
# this task may be running in a loop in which case the notification
|
# this task may be running in a loop in which case the notification
|
||||||
# may be item-specific, ie. "notify: service {{item}}"
|
# may be item-specific, ie. "notify: service {{item}}"
|
||||||
if self._task.notify:
|
if self._task.notify is not None:
|
||||||
result['ansible_notify'] = self._task.notify
|
result['ansible_notify'] = self._task.notify
|
||||||
|
|
||||||
# and return
|
# and return
|
||||||
|
|
|
@ -28,7 +28,7 @@ class ActionModule(ActionBase):
|
||||||
# Remove special fields from the result, which can only be set
|
# Remove special fields from the result, which can only be set
|
||||||
# internally by the executor engine. We do this only here in
|
# internally by the executor engine. We do this only here in
|
||||||
# the 'normal' action, as other action plugins may set this.
|
# the 'normal' action, as other action plugins may set this.
|
||||||
for field in ('ansible_facts', 'ansible_notify'):
|
for field in ('ansible_notify',):
|
||||||
if field in results:
|
if field in results:
|
||||||
results.pop(field)
|
results.pop(field)
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,6 @@ class StrategyBase:
|
||||||
elif result[0] == 'notify_handler':
|
elif result[0] == 'notify_handler':
|
||||||
host = result[1]
|
host = result[1]
|
||||||
handler_name = result[2]
|
handler_name = result[2]
|
||||||
|
|
||||||
if handler_name not in self._notified_handlers:
|
if handler_name not in self._notified_handlers:
|
||||||
self._notified_handlers[handler_name] = []
|
self._notified_handlers[handler_name] = []
|
||||||
|
|
||||||
|
@ -425,7 +424,7 @@ class StrategyBase:
|
||||||
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=handler)
|
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=handler)
|
||||||
task_vars = self.add_tqm_variables(task_vars, play=iterator._play)
|
task_vars = self.add_tqm_variables(task_vars, play=iterator._play)
|
||||||
self._queue_task(host, handler, task_vars, connection_info)
|
self._queue_task(host, handler, task_vars, connection_info)
|
||||||
handler.flag_for_host(host)
|
#handler.flag_for_host(host)
|
||||||
self._process_pending_results(iterator)
|
self._process_pending_results(iterator)
|
||||||
self._wait_on_pending_results(iterator)
|
self._wait_on_pending_results(iterator)
|
||||||
# wipe the notification list
|
# wipe the notification list
|
||||||
|
|
Loading…
Reference in a new issue