From 05fcb8502f3dc5fbb5fc2de2b56373187dc07e22 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 25 Apr 2019 22:22:06 -0400 Subject: [PATCH] options not optional for callbacks (#55660) fixes #55305 --- changelogs/fragments/cb_options_unoptional.yml | 2 ++ lib/ansible/executor/task_queue_manager.py | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) create mode 100644 changelogs/fragments/cb_options_unoptional.yml diff --git a/changelogs/fragments/cb_options_unoptional.yml b/changelogs/fragments/cb_options_unoptional.yml new file mode 100644 index 0000000000..b7e2032a0d --- /dev/null +++ b/changelogs/fragments/cb_options_unoptional.yml @@ -0,0 +1,2 @@ +minor_changes: + - Now callback plugins MUST allow for setting options as deprecation period that allowed older callbacks to ignore this is over. diff --git a/lib/ansible/executor/task_queue_manager.py b/lib/ansible/executor/task_queue_manager.py index 9543a93441..a4962617a3 100644 --- a/lib/ansible/executor/task_queue_manager.py +++ b/lib/ansible/executor/task_queue_manager.py @@ -132,12 +132,7 @@ class TaskQueueManager: raise AnsibleError("Invalid callback for stdout specified: %s" % self._stdout_callback) else: self._stdout_callback = callback_loader.get(self._stdout_callback) - try: - self._stdout_callback.set_options() - except AttributeError: - display.deprecated("%s stdout callback, does not support setting 'options', it will work for now, " - " but this will be required in the future and should be updated," - " see the 2.4 porting guide for details." % self._stdout_callback._load_name, version="2.9") + self._stdout_callback.set_options() stdout_callback_loaded = True else: raise AnsibleError("callback must be an instance of CallbackBase or the name of a callback plugin") @@ -160,12 +155,7 @@ class TaskQueueManager: continue callback_obj = callback_plugin() - try: - callback_obj.set_options() - except AttributeError: - display.deprecated("%s callback, does not support setting 'options', it will work for now, " - " but this will be required in the future and should be updated, " - " see the 2.4 porting guide for details." % callback_obj._load_name, version="2.9") + callback_obj.set_options() self._callback_plugins.append(callback_obj) for callback_plugin_name in (c for c in C.DEFAULT_CALLBACK_WHITELIST if is_collection_ref(c)):