mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
added playbook and options info to callbacks
will display on certain verbosity levels, both playbook/file info and non empty options with which it's running. avoid errors when not using CLI classes
This commit is contained in:
@@ -39,6 +39,11 @@ except ImportError:
|
||||
|
||||
__all__ = ["CallbackBase"]
|
||||
|
||||
try:
|
||||
from __main__ import cli
|
||||
except ImportError:
|
||||
# using API w/o cli
|
||||
cli = False
|
||||
|
||||
class CallbackBase:
|
||||
|
||||
@@ -54,6 +59,11 @@ class CallbackBase:
|
||||
else:
|
||||
self._display = global_display
|
||||
|
||||
if cli:
|
||||
self._options = cli.options
|
||||
else:
|
||||
self._options = None
|
||||
|
||||
if self._display.verbosity >= 4:
|
||||
name = getattr(self, 'CALLBACK_NAME', 'unnamed')
|
||||
ctype = getattr(self, 'CALLBACK_TYPE', 'old')
|
||||
|
||||
Reference in New Issue
Block a user