diff --git a/roles/ipasmartcard_client/library/ipasmartcard_client_get_vars.py b/roles/ipasmartcard_client/library/ipasmartcard_client_get_vars.py index ed1dc41efe551d449effa8c6092e0db5ccd0825f..6c83419d8ded8699a0968cbd05b972cd0e861696 100644 --- a/roles/ipasmartcard_client/library/ipasmartcard_client_get_vars.py +++ b/roles/ipasmartcard_client/library/ipasmartcard_client_get_vars.py @@ -64,7 +64,13 @@ python_interpreter: import sys from ansible.module_utils.basic import AnsibleModule -from ipaplatform.paths import paths +try: + from ipaplatform.paths import paths +except ImportError as _err: + MODULE_IMPORT_ERROR = str(_err) + paths = None +else: + MODULE_IMPORT_ERROR = None def main(): @@ -73,6 +79,9 @@ def main(): supports_check_mode=False, ) + if MODULE_IMPORT_ERROR is not None: + ansible_module.fail_json(msg=MODULE_IMPORT_ERROR) + ansible_module.exit_json(changed=False, NSS_DB_DIR=paths.NSS_DB_DIR, USE_AUTHSELECT=hasattr(paths, "AUTHSELECT"),