We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3dffa11 + 6587078 commit 9f10335Copy full SHA for 9f10335
datadog_callback.py
@@ -16,7 +16,10 @@
16
17
import ansible
18
from ansible.plugins.callback import CallbackBase
19
-from __main__ import cli
+try:
20
+ from __main__ import cli
21
+except ImportError:
22
+ cli = False
23
24
ANSIBLE_ABOVE_28 = False
25
if IMPORT_ERROR is None and version.parse(ansible.__version__) >= version.parse('2.8.0'):
@@ -43,10 +46,10 @@ def __init__(self):
43
46
self._playbook_name = None
44
47
self._start_time = time.time()
45
48
self._options = None
- if IMPORT_ERROR is None and cli:
49
+ if IMPORT_ERROR is None:
50
if ANSIBLE_ABOVE_28:
51
self._options = CLIARGS
- else:
52
+ elif cli:
53
self._options = cli.options
54
55
# self.playbook is set in the `v2_playbook_on_start` callback method
0 commit comments