Debian Codegraph @

test/integration/targets/callback-dispatch/callback_plugins/oops_always_enabled.py

raw
1 from __future__ import annotations
2
3 import os
4 import typing as t
5
6 from ansible.plugins.callback import CallbackBase
7
8
9 class CallbackModule(CallbackBase):
10 call_count: t.ClassVar[int] = 0
11
12 def v2_runner_on_ok(self, *args, **kwargs) -> None:
13 print(f"hello from ALWAYS ENABLED v2_runner_on_ok {args=} {kwargs=}")
14
15 CallbackModule.call_count += 1
16
17 def v2_playbook_on_stats(self, stats):
18 print('hello from ALWAYS ENABLED v2_playbook_on_stats')
19
20 if os.environ.get('_ASSERT_OOPS'):
21 assert CallbackModule.call_count < 2, "always enabled callback should not "
22 print("no double callbacks test PASS")