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:
Brian Coca
2015-12-02 20:36:21 -08:00
parent 0a4642fcc2
commit 6012646d8c
2 changed files with 23 additions and 0 deletions

View File

@@ -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')