feat(modules): try catch on import

This commit is contained in:
Bertrand Lanson 2023-12-27 13:40:25 +01:00
parent e514e066a2
commit 779e6e3864

View File

@ -68,7 +68,15 @@ message:
''' '''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
import hvac
try:
import hvac
except ImportError:
HAS_HVAC = False
HVAC_IMPORT_ERROR = traceback.format_exc()
else:
HVAC_IMPORT_ERROR = None
HAS_HVAC = True
def run_module(): def run_module():
# define available arguments/parameters a user can pass to the module # define available arguments/parameters a user can pass to the module