def __virtual__(): ''' Check for required version of boto and make this pillar available depending on outcome. ''' if not HAS_BOTO: return False boto_version = _StrictVersion(boto.__version__) required_boto_version = _StrictVersion('2.8.0') if boto_version < required_boto_version: log.error("%s: installed boto version %s < %s, can't retrieve instance data", __name__, boto_version, required_boto_version) return False return True
def __virtual__(): ''' Set the system module of the kernel is Windows ''' if not salt.utils.is_windows(): return False, 'Module PSGet: Module only works on Windows systems' # Verify PowerShell 5.0 powershell_info = __salt__['cmd.shell_info']('powershell') if not powershell_info['installed'] or \ _StrictVersion( powershell_info['version']) >= _StrictVersion('5.0'): return False, 'Module DSC: Module only works with PowerShell 5 or ' \ 'newer.' return __virtualname__
def __virtual__(): ''' Set the system module of the kernel is Windows ''' # Verify Windows if not salt.utils.is_windows(): return False, 'Module DSC: Only available on Windows systems' # Verify PowerShell 5.0 powershell_info = __salt__['cmd.shell_info']('powershell') if not powershell_info['installed']: return False, 'Module DSC: PowerShell not available' if _StrictVersion(powershell_info['version']) < \ _StrictVersion('5.0'): return False, 'Module DSC: Requires PowerShell 5 or later' return __virtualname__
# Import salt libs import salt.auth from salt.utils.versions import StrictVersion as _StrictVersion __virtualname__ = os.path.abspath(__file__).rsplit( os.sep)[-2] or 'rest_tornado' logger = logging.getLogger(__virtualname__) # we require at least 4.0, as that includes all the Future's stuff we use min_tornado_version = '4.0' has_tornado = False try: import tornado if _StrictVersion(tornado.version) >= _StrictVersion(min_tornado_version): has_tornado = True else: logger.error('rest_tornado requires at least tornado {0}'.format( min_tornado_version)) except (ImportError, TypeError) as err: has_tornado = False logger.error('ImportError! {0}'.format(str(err))) def __virtual__(): mod_opts = __opts__.get(__virtualname__, {}) if has_tornado and 'port' in mod_opts: return __virtualname__
# Import salt libs import salt.auth from salt.utils.versions import StrictVersion as _StrictVersion __virtualname__ = os.path.abspath(__file__).rsplit( os.sep)[-2] or 'rest_tornado' log = logging.getLogger(__virtualname__) # we require at least 4.0, as that includes all the Future's stuff we use min_tornado_version = '4.0' has_tornado = False try: import salt.ext.tornado if _StrictVersion( salt.ext.tornado.version) >= _StrictVersion(min_tornado_version): has_tornado = True else: log.error('rest_tornado requires at least tornado %s', min_tornado_version) except (ImportError, TypeError) as err: has_tornado = False log.error('ImportError! %s', err) def __virtual__(): mod_opts = __opts__.get(__virtualname__, {}) if has_tornado and 'port' in mod_opts: return __virtualname__