diff options
Diffstat (limited to '')
-rw-r--r-- | test/integration/targets/ansible/callback_plugins/callback_debug.py | 24 | ||||
-rw-r--r-- | test/integration/targets/ansible/callback_plugins/callback_meta.py | 23 |
2 files changed, 47 insertions, 0 deletions
diff --git a/test/integration/targets/ansible/callback_plugins/callback_debug.py b/test/integration/targets/ansible/callback_plugins/callback_debug.py new file mode 100644 index 0000000..2462c1f --- /dev/null +++ b/test/integration/targets/ansible/callback_plugins/callback_debug.py @@ -0,0 +1,24 @@ +# (c) 2020 Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +from ansible.plugins.callback import CallbackBase + + +class CallbackModule(CallbackBase): + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'stdout' + CALLBACK_NAME = 'callback_debug' + + def __init__(self, *args, **kwargs): + super(CallbackModule, self).__init__(*args, **kwargs) + self._display.display('__init__') + + for cb in [x for x in dir(CallbackBase) if x.startswith('v2_')]: + delattr(CallbackBase, cb) + + def __getattr__(self, name): + if name.startswith('v2_'): + return lambda *args, **kwargs: self._display.display(name) diff --git a/test/integration/targets/ansible/callback_plugins/callback_meta.py b/test/integration/targets/ansible/callback_plugins/callback_meta.py new file mode 100644 index 0000000..e19c80f --- /dev/null +++ b/test/integration/targets/ansible/callback_plugins/callback_meta.py @@ -0,0 +1,23 @@ +# (c) 2020 Ansible Project +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +from ansible.plugins.callback import CallbackBase +import os + + +class CallbackModule(CallbackBase): + CALLBACK_VERSION = 2.0 + CALLBACK_TYPE = 'stdout' + CALLBACK_NAME = 'callback_meta' + + def __init__(self, *args, **kwargs): + super(CallbackModule, self).__init__(*args, **kwargs) + self.wants_implicit_tasks = os.environ.get('CB_WANTS_IMPLICIT', False) + + def v2_playbook_on_task_start(self, task, is_conditional): + if task.implicit: + self._display.display('saw implicit task') + self._display.display(task.get_name()) |