mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ensure stdout callback alwasy is loaded first
it is now called for every event prior to any other callbacks fixes #14114
This commit is contained in:
parent
af88e34831
commit
87fe32319f
1 changed files with 4 additions and 2 deletions
|
@ -144,11 +144,13 @@ class TaskQueueManager:
|
||||||
self._stdout_callback = C.DEFAULT_STDOUT_CALLBACK
|
self._stdout_callback = C.DEFAULT_STDOUT_CALLBACK
|
||||||
|
|
||||||
if isinstance(self._stdout_callback, CallbackBase):
|
if isinstance(self._stdout_callback, CallbackBase):
|
||||||
self._callback_plugins.append(self._stdout_callback)
|
|
||||||
stdout_callback_loaded = True
|
stdout_callback_loaded = True
|
||||||
elif isinstance(self._stdout_callback, basestring):
|
elif isinstance(self._stdout_callback, basestring):
|
||||||
if self._stdout_callback not in callback_loader:
|
if self._stdout_callback not in callback_loader:
|
||||||
raise AnsibleError("Invalid callback for stdout specified: %s" % self._stdout_callback)
|
raise AnsibleError("Invalid callback for stdout specified: %s" % self._stdout_callback)
|
||||||
|
else:
|
||||||
|
self._stdout_callback = callback_loader.get(self._stdout_callback)
|
||||||
|
stdout_callback_loaded = True
|
||||||
else:
|
else:
|
||||||
raise AnsibleError("callback must be an instance of CallbackBase or the name of a callback plugin")
|
raise AnsibleError("callback must be an instance of CallbackBase or the name of a callback plugin")
|
||||||
|
|
||||||
|
@ -276,7 +278,7 @@ class TaskQueueManager:
|
||||||
self._terminated = True
|
self._terminated = True
|
||||||
|
|
||||||
def send_callback(self, method_name, *args, **kwargs):
|
def send_callback(self, method_name, *args, **kwargs):
|
||||||
for callback_plugin in self._callback_plugins:
|
for callback_plugin in [self._stdout_callback] + self._callback_plugins:
|
||||||
# a plugin that set self.disabled to True will not be called
|
# a plugin that set self.disabled to True will not be called
|
||||||
# see osx_say.py example for such a plugin
|
# see osx_say.py example for such a plugin
|
||||||
if getattr(callback_plugin, 'disabled', False):
|
if getattr(callback_plugin, 'disabled', False):
|
||||||
|
|
Loading…
Reference in a new issue