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:
|
else:
|
||||||
cb = 'minimal'
|
cb = 'minimal'
|
||||||
|
|
||||||
|
run_tree=False
|
||||||
if self.options.tree:
|
if self.options.tree:
|
||||||
C.DEFAULT_CALLBACK_WHITELIST.append('tree')
|
C.DEFAULT_CALLBACK_WHITELIST.append('tree')
|
||||||
C.TREE_DIR = self.options.tree
|
C.TREE_DIR = self.options.tree
|
||||||
|
run_tree=True
|
||||||
|
|
||||||
# now create a task queue manager to execute the play
|
# now create a task queue manager to execute the play
|
||||||
self._tqm = None
|
self._tqm = None
|
||||||
|
@ -178,6 +180,7 @@ class AdHocCLI(CLI):
|
||||||
passwords=passwords,
|
passwords=passwords,
|
||||||
stdout_callback=cb,
|
stdout_callback=cb,
|
||||||
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
|
||||||
|
run_tree=run_tree,
|
||||||
)
|
)
|
||||||
result = self._tqm.run(play)
|
result = self._tqm.run(play)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -56,7 +56,7 @@ class TaskQueueManager:
|
||||||
which dispatches the Play's tasks to hosts.
|
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._inventory = inventory
|
||||||
self._variable_manager = variable_manager
|
self._variable_manager = variable_manager
|
||||||
|
@ -66,6 +66,7 @@ class TaskQueueManager:
|
||||||
self.passwords = passwords
|
self.passwords = passwords
|
||||||
self._stdout_callback = stdout_callback
|
self._stdout_callback = stdout_callback
|
||||||
self._run_additional_callbacks = run_additional_callbacks
|
self._run_additional_callbacks = run_additional_callbacks
|
||||||
|
self._run_tree = run_tree
|
||||||
|
|
||||||
self._callbacks_loaded = False
|
self._callbacks_loaded = False
|
||||||
self._callback_plugins = []
|
self._callback_plugins = []
|
||||||
|
@ -160,6 +161,8 @@ class TaskQueueManager:
|
||||||
if callback_name != self._stdout_callback or stdout_callback_loaded:
|
if callback_name != self._stdout_callback or stdout_callback_loaded:
|
||||||
continue
|
continue
|
||||||
stdout_callback_loaded = True
|
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)):
|
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
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue