Added python/pyvmomi compatibility check to salt.modules.vsphere

This commit is contained in:
Alexandru Bleotu 2017-09-21 12:13:08 -04:00
parent 5f30477a6a
commit 2f55841037

View File

@ -193,7 +193,7 @@ except ImportError:
HAS_JSONSCHEMA = False
try:
from pyVmomi import vim, vmodl
from pyVmomi import vim, vmodl, VmomiSupport
HAS_PYVMOMI = True
except ImportError:
HAS_PYVMOMI = False
@ -211,6 +211,17 @@ __proxyenabled__ = ['esxi', 'esxcluster', 'esxdatacenter']
def __virtual__():
if not HAS_JSONSCHEMA:
return False, 'Execution module did not load: jsonschema not found'
if not HAS_PYVMOMI:
return False, 'Execution module did not load: pyVmomi not found'
# We check the supported vim versions to infer the pyVmomi version
if 'vim25/6.0' in VmomiSupport.versionMap and \
sys.version_info > (2, 7) and sys.version_info < (2, 7, 9):
return False, ('Execution module did not load: Incompatible versions '
'of Python and pyVmomi present. See Issue #29537.')
return __virtualname__