diff --git a/plugins/module_utils/crypto/support.py b/plugins/module_utils/crypto/support.py index 646199851..1577abc82 100644 --- a/plugins/module_utils/crypto/support.py +++ b/plugins/module_utils/crypto/support.py @@ -32,7 +32,7 @@ try: from OpenSSL import crypto HAS_PYOPENSSL = True -except ImportError: +except (ImportError, AttributeError): # Error handled in the calling module. HAS_PYOPENSSL = False diff --git a/plugins/modules/openssl_pkcs12.py b/plugins/modules/openssl_pkcs12.py index 5c91d6e84..2702914e6 100644 --- a/plugins/modules/openssl_pkcs12.py +++ b/plugins/modules/openssl_pkcs12.py @@ -276,7 +276,7 @@ import OpenSSL from OpenSSL import crypto PYOPENSSL_VERSION = LooseVersion(OpenSSL.__version__) -except ImportError: +except (ImportError, AttributeError): PYOPENSSL_IMP_ERR = traceback.format_exc() PYOPENSSL_FOUND = False else: