Skip to content

Commit

Permalink
Use get_option api from callback plugins
Browse files Browse the repository at this point in the history
To load options, callback plugins can use `get_option` api.
Allow this functionality for other callback plugin.

Fixes: ansible#1077

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde committed Oct 10, 2022
1 parent d068d1f commit 2150440
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ansible_runner/display_callback/callback/awx_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
else:
default_stdout_callback = 'default'

DefaultCallbackModule = callback_loader.get(default_stdout_callback).__class__
DefaultCallbackModule = callback_loader.get(default_stdout_callback, class_only=True)

CENSORED = "the output has been hidden due to the fact that 'no_log: true' was specified for this result"

Expand Down Expand Up @@ -348,6 +348,12 @@ def __init__(self):
self.play_uuids = set()
self.duplicate_play_counts = collections.defaultdict(lambda: 1)

def set_options(self, task_keys=None, var_options=None, direct=None):
base_config = C.config.get_configuration_definition(DefaultCallbackModule._load_name, plugin_type='callback')
my_config = C.config.get_configuration_definition(self._load_name, plugin_type='callback')
C.config.initialize_plugin_configuration_definitions('callback', self._load_name, base_config | my_config)
return super().set_options(task_keys=task_keys, var_options=var_options, direct=direct)

@contextlib.contextmanager
def capture_event_data(self, event, **event_data):
event_data.setdefault('uuid', str(uuid.uuid4()))
Expand Down

0 comments on commit 2150440

Please sign in to comment.