adhoc avoids callbacks by default as it did before

Previous emptying of whitelist only affected callbacks that were
constructed for need whitelist. This now works for all callbacks.
This commit is contained in:
Brian Coca 2015-12-09 10:01:21 -08:00
parent 0211da2fe9
commit 7936a4687e
2 changed files with 4 additions and 5 deletions

View file

@ -163,9 +163,6 @@ class AdHocCLI(CLI):
else:
cb = 'minimal'
if not C.DEFAULT_LOAD_CALLBACK_PLUGINS:
C.DEFAULT_CALLBACK_WHITELIST = []
if self.options.tree:
C.DEFAULT_CALLBACK_WHITELIST.append('tree')
C.TREE_DIR = self.options.tree
@ -180,6 +177,7 @@ class AdHocCLI(CLI):
options=self.options,
passwords=passwords,
stdout_callback=cb,
run_additional_callbacks=C.DEFAULT_LOAD_CALLBACK_PLUGINS,
)
result = self._tqm.run(play)
finally:

View file

@ -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):
def __init__(self, inventory, variable_manager, loader, options, passwords, stdout_callback=None, run_additional_callbacks=True):
self._inventory = inventory
self._variable_manager = variable_manager
@ -65,6 +65,7 @@ class TaskQueueManager:
self._stats = AggregateStats()
self.passwords = passwords
self._stdout_callback = stdout_callback
self._run_additional_callbacks = run_additional_callbacks
self._callbacks_loaded = False
self._callback_plugins = []
@ -159,7 +160,7 @@ class TaskQueueManager:
if callback_name != self._stdout_callback or stdout_callback_loaded:
continue
stdout_callback_loaded = True
elif 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
self._callback_plugins.append(callback_plugin())