From 21c14363fdab8c4d7cd5a8c900153744746c511d Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 29 Jun 2015 10:55:48 -0400 Subject: [PATCH] Allow callback plugins to be whitelisted --- lib/ansible/constants.py | 1 + lib/ansible/executor/task_queue_manager.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 8f9c5bf5103..db0cabb10fa 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -188,6 +188,7 @@ DEPRECATION_WARNINGS = get_config(p, DEFAULTS, 'deprecation_warnings', DEFAULT_CALLABLE_WHITELIST = get_config(p, DEFAULTS, 'callable_whitelist', 'ANSIBLE_CALLABLE_WHITELIST', [], islist=True) COMMAND_WARNINGS = get_config(p, DEFAULTS, 'command_warnings', 'ANSIBLE_COMMAND_WARNINGS', False, boolean=True) DEFAULT_LOAD_CALLBACK_PLUGINS = get_config(p, DEFAULTS, 'bin_ansible_callbacks', 'ANSIBLE_LOAD_CALLBACK_PLUGINS', False, boolean=True) +DEFAULT_CALLBACK_WHITELIST = get_config(p, DEFAULTS, 'callback_whitelist', 'ANSIBLE_CALLBACK_WHITELIST', None, islist=True) RETRY_FILES_ENABLED = get_config(p, DEFAULTS, 'retry_files_enabled', 'ANSIBLE_RETRY_FILES_ENABLED', True, boolean=True) RETRY_FILES_SAVE_PATH = get_config(p, DEFAULTS, 'retry_files_save_path', 'ANSIBLE_RETRY_FILES_SAVE_PATH', '~/') diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index debcf6873d8..b1d905be7ad 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -144,6 +144,8 @@ class TaskQueueManager: if callback_name != stdout_callback or stdout_callback_loaded: continue stdout_callback_loaded = True + elif C.DEFAULT_CALLBACK_WHITELIST is not None and callback_name not in C.DEFAULT_CALLBACK_WHITELIST: + continue loaded_plugins.append(callback_plugin(self._display)) else: