reenabled --tree for ansible adhoc command
previous fix to avoid callbacks now conflicted with tree optoin which is implemented as a callback in 2.0
This commit is contained in:
parent
7936a4687e
commit
04d74fd680
2 changed files with 7 additions and 1 deletions
|
@ -163,9 +163,11 @@ class AdHocCLI(CLI):
|
|||
else:
|
||||
cb = 'minimal'
|
||||
|
||||
run_tree=False
|
||||
if self.options.tree:
|
||||
C.DEFAULT_CALLBACK_WHITELIST.append('tree')
|
||||
C.TREE_DIR = self.options.tree
|
||||
run_tree=True
|
||||
|
||||
# now create a task queue manager to execute the play
|
||||
self._tqm = None
|
||||
|
@ -178,6 +180,7 @@ class AdHocCLI(CLI):
|
|||
passwords=passwords,
|
||||
stdout_callback=cb,
|
||||
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
||||
run_tree=run_tree,
|
||||
)
|
||||
result = self._tqm.run(play)
|
||||
finally:
|
||||
|
|
|
@ -56,7 +56,7 @@ class TaskQueueManager:
|
|||
which dispatches the Play's tasks to hosts.
|
||||
'''
|
||||
|
||||
def __init__(self, inventory, variable_manager, loader, options, passwords, stdout_callback=None, run_additional_callbacks=True):
|
||||
def __init__(self, inventory, variable_manager, loader, options, passwords, stdout_callback=None, run_additional_callbacks=True, run_tree=False):
|
||||
|
||||
self._inventory = inventory
|
||||
self._variable_manager = variable_manager
|
||||
|
@ -66,6 +66,7 @@ class TaskQueueManager:
|
|||
self.passwords = passwords
|
||||
self._stdout_callback = stdout_callback
|
||||
self._run_additional_callbacks = run_additional_callbacks
|
||||
self._run_tree = run_tree
|
||||
|
||||
self._callbacks_loaded = False
|
||||
self._callback_plugins = []
|
||||
|
@ -160,6 +161,8 @@ class TaskQueueManager:
|
|||
if callback_name != self._stdout_callback or stdout_callback_loaded:
|
||||
continue
|
||||
stdout_callback_loaded = True
|
||||
elif callback_name == 'tree' and self._run_tree:
|
||||
pass
|
||||
elif not self._run_additional_callbacks or (callback_needs_whitelist and (C.DEFAULT_CALLBACK_WHITELIST is None or callback_name not in C.DEFAULT_CALLBACK_WHITELIST)):
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in a new issue