File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 15
15
- Credits to authors of splunk callback plugin.
16
16
version_added: "2.4.0"
17
17
requirements:
18
+ - The Python 'requests' module.
18
19
- Whitelisting this callback plugin.
19
20
- An Azure log analytics work space has been established.
20
21
options:
Original file line number Diff line number Diff line change 138
138
'''
139
139
140
140
import getpass
141
- import requests
141
+ try :
142
+ import requests
143
+ except ImportError as exception :
144
+ IMPORT_ERROR_REQUESTS = exception
145
+ else :
146
+ IMPORT_ERROR_REQUESTS = None
142
147
import socket
143
148
import uuid
144
149
from datetime import datetime , timezone , timedelta
@@ -273,6 +278,8 @@ class CallbackModule(CallbackBase):
273
278
CALLBACK_NEEDS_ENABLED = True
274
279
275
280
def __init__ (self , display = None ):
281
+ if IMPORT_ERROR_REQUESTS :
282
+ raise AnsibleError ("'requests' must be installed in order to use this plugin" ) from IMPORT_ERROR_REQUESTS
276
283
super (CallbackModule , self ).__init__ (display = display )
277
284
self .start_datetimes = {}
278
285
self .playbook_name = None
You can’t perform that action at this time.
0 commit comments