Only add task for non-handler cases and stop calling callback

pull/82212/head
Jordan Borean 1 year ago
parent 24884bc0fc
commit 61c9324eb9
No known key found for this signature in database
GPG Key ID: 2AAC89085FBBDAB5

@ -1,5 +1,4 @@
minor_changes: minor_changes:
- >- - >-
Include the explicit import_tasks and import_role tasks in the play iterator for the strategy to see. By default Include the explicit import_tasks and import_role tasks in the play iterator for the strategy to see. By default
these tasks are skipped but a strategy can utilise them in a special way if needed. This will cause the import_* to these tasks are skipped but a strategy can utilise them in a special way if needed.
be displayed in UI as a normal task when it is run.

@ -241,7 +241,9 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
loader=loader, loader=loader,
variable_manager=variable_manager, variable_manager=variable_manager,
) )
task_list.append(ti_copy)
if not use_handlers:
task_list.append(ti_copy)
tags = ti_copy.tags[:] tags = ti_copy.tags[:]
@ -286,7 +288,9 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
templar = Templar(loader=loader, variables=all_vars) templar = Templar(loader=loader, variables=all_vars)
ir.post_validate(templar=templar) ir.post_validate(templar=templar)
ir._role_name = templar.template(ir._role_name) ir._role_name = templar.template(ir._role_name)
task_list.append(ir)
if not use_handlers:
task_list.append(ir)
# uses compiled list from object # uses compiled list from object
blocks, dummy = ir.get_block_list(variable_manager=variable_manager, loader=loader) blocks, dummy = ir.get_block_list(variable_manager=variable_manager, loader=loader)

@ -191,7 +191,7 @@ class StrategyModule(StrategyBase):
"as tasks are executed independently on each host") "as tasks are executed independently on each host")
if isinstance(task, Handler): if isinstance(task, Handler):
self._tqm.send_callback('v2_playbook_on_handler_task_start', task) self._tqm.send_callback('v2_playbook_on_handler_task_start', task)
else: elif action not in C._ACTION_IMPORT_TASKS + C._ACTION_IMPORT_ROLE:
self._tqm.send_callback('v2_playbook_on_task_start', task, is_conditional=False) self._tqm.send_callback('v2_playbook_on_task_start', task, is_conditional=False)
self._queue_task(host, task, task_vars, play_context) self._queue_task(host, task, task_vars, play_context)
# each task is counted as a worker being busy # each task is counted as a worker being busy

@ -230,7 +230,7 @@ class StrategyModule(StrategyBase):
display.debug("here goes the callback...") display.debug("here goes the callback...")
if isinstance(task, Handler): if isinstance(task, Handler):
self._tqm.send_callback('v2_playbook_on_handler_task_start', task) self._tqm.send_callback('v2_playbook_on_handler_task_start', task)
else: elif action not in C._ACTION_IMPORT_TASKS + C._ACTION_IMPORT_ROLE:
self._tqm.send_callback('v2_playbook_on_task_start', task, is_conditional=False) self._tqm.send_callback('v2_playbook_on_task_start', task, is_conditional=False)
task.name = saved_name task.name = saved_name
callback_sent = True callback_sent = True

Loading…
Cancel
Save