tell user when x509 exec/state module can't load

Fixes #27595.
This commit is contained in:
Justin Findlay 2015-10-06 12:46:35 -06:00
parent 06e67d25f8
commit 6bf2ee2751
2 changed files with 13 additions and 1 deletions

View file

@ -63,10 +63,13 @@ CERT_DEFAULTS = {'days_valid': 365, 'version': 3, 'serial_bits': 64, 'algorithm'
def __virtual__():
'''
only load this module if m2crypto is available
'''
if HAS_M2:
return __virtualname__
else:
return False
return (False, 'Could not load x509 module, m2crypto unavailable')
class _Ctx(ctypes.Structure):

View file

@ -168,6 +168,15 @@ import salt.utils
# Import 3rd-party libs
import salt.ext.six as six
def __virtual__():
'''
only load this module if the corresponding execution module is loaded
'''
if 'x509.get_pem_entry' in __salt__:
return 'x509'
else:
return (False, 'Could not load x509 state: m2crypto unavailable')
def _revoked_to_list(revs):
'''