Пример #1
0
    def test_config_set_value_with_space_character(self):
        '''
        git.config
        '''
        from salt.utils import which
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        name = tempfile.mkdtemp(dir=integration.TMP)
        self.addCleanup(shutil.rmtree, name, ignore_errors=True)
        subprocess.check_call(['git', 'init', '--quiet', name])

        config_key = 'user.name'
        config_value = 'foo bar'

        ret = self.run_state('git.config',
                             name=config_key,
                             value=config_value,
                             repo=name,
                             is_global=False)
        self.assertSaltTrueReturn(ret)

        output = subprocess.check_output(
            ['git', 'config', '--local', config_key], cwd=name)
        self.assertEqual(config_value + "\n", output)
Пример #2
0
def __virtual__():
    '''
    Only load if git exists on the system
    '''
    if not all((utils.which('git'), HAS_PIPES)):
        return False
    return True
Пример #3
0
def __virtual__():
    '''
    Only load if git exists on the system
    '''
    if not all((utils.which('git'), HAS_PIPES)):
        return False
    return True
Пример #4
0
def __virtual__():
    '''
    Only load if svn is installed
    '''
    if utils.which('svn'):
        return 'svn'
    return False
Пример #5
0
    def test_config_set_value_with_space_character(self):
        '''
        git.config
        '''
        from salt.utils import which
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        name = tempfile.mkdtemp(dir=integration.TMP)
        self.addCleanup(shutil.rmtree, name, ignore_errors=True)
        subprocess.check_call(['git', 'init', '--quiet', name])

        config_key = 'user.name'
        config_value = 'foo bar'

        ret = self.run_state(
            'git.config',
            name=config_key,
            value=config_value,
            repo=name,
            is_global=False)
        self.assertSaltTrueReturn(ret)

        output = subprocess.check_output(
            ['git', 'config', '--local', config_key],
            cwd=name)
        self.assertEqual(config_value + "\n", output)
Пример #6
0
def __virtual__():
    '''
    Only load if svn is installed
    '''
    if utils.which('svn'):
        return 'svn'
    return False
Пример #7
0
    def test_salt_with_git_version(self):
        if getattr(self, '_call_binary_', None) is None:
            self.skipTest('\'_call_binary_\' not defined.')
        from salt.utils import which
        from salt.version import __version_info__, GIT_DESCRIBE_REGEX
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        # Let's get the output of git describe
        process = subprocess.Popen(
            [git, 'describe', '--tags', '--match', 'v[0-9]*'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True,
            cwd=CODE_DIR
        )
        out, err = process.communicate()
        if not out:
            self.skipTest(
                'Failed to get the output of \'git describe\'. '
                'Error: {0!r}'.format(
                    err
                )
            )

        match = re.search(GIT_DESCRIBE_REGEX, out)
        if not match:
            return version, version_info

        parsed_version = '{0}.{1}.{2}'.format(
            match.group('major'),
            match.group('minor'),
            match.group('bugfix') or '0'
        )
        parsed_version_info = tuple([
            int(g) for g in [h or '0' for h in match.groups()[:3]]
            if g.isdigit()
        ])

        if parsed_version_info and parsed_version_info < __version_info__:
            self.skipTest(
                'We\'re likely about to release a new version. This test '
                'would fail. Parsed({0!r}) < Expected({1!r})'.format(
                    parsed_version_info, __version_info__
                )
            )
        elif parsed_version_info != __version_info__:
            self.skipTest(
                'In order to get the proper salt version with the '
                'git hash you need to update salt\'s local git '
                'tags. Something like: \'git fetch --tags\' or '
                '\'git fetch --tags upstream\' if you followed '
                'salt\'s contribute documentation. The version '
                'string WILL NOT include the git hash.'
            )
        out = '\n'.join(self.run_script(self._call_binary_, '--version'))
        self.assertIn(parsed_version, out)
Пример #8
0
    def test_salt_with_git_version(self):
        if getattr(self, '_call_binary_', None) is None:
            self.skipTest('\'_call_binary_\' not defined.')
        from salt.utils import which
        from salt.version import __version_info__, GIT_DESCRIBE_REGEX
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        # Let's get the output of git describe
        process = subprocess.Popen(
            [git, 'describe', '--tags', '--match', 'v[0-9]*'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True,
            cwd=CODE_DIR
        )
        out, err = process.communicate()
        if not out:
            self.skipTest(
                'Failed to get the output of \'git describe\'. '
                'Error: {0!r}'.format(
                    err
                )
            )

        match = re.search(GIT_DESCRIBE_REGEX, out)
        if not match:
            return version, version_info

        parsed_version = '{0}.{1}.{2}'.format(
            match.group('major'),
            match.group('minor'),
            match.group('bugfix') or '0'
        )
        parsed_version_info = tuple([
            int(g) for g in [h or '0' for h in match.groups()[:3]]
            if g.isdigit()
        ])

        if parsed_version_info and parsed_version_info < __version_info__:
            self.skipTest(
                'We\'re likely about to release a new version. This test '
                'would fail. Parsed({0!r}) < Expected({1!r})'.format(
                    parsed_version_info, __version_info__
                )
            )
        elif parsed_version_info != __version_info__:
            self.skipTest(
                'In order to get the proper salt version with the '
                'git hash you need to update salt\'s local git '
                'tags. Something like: \'git fetch --tags\' or '
                '\'git fetch --tags upstream\' if you followed '
                'salt\'s contribute documentation. The version '
                'string WILL NOT include the git hash.'
            )
        out = '\n'.join(self.run_script(self._call_binary_, '--version'))
        self.assertIn(parsed_version, out)
Пример #9
0
def __virtual__():
    '''
    Only load if hg is installed
    '''
    if utils.which('hg') is None:
        return (False,
                'The hg execution module cannot be loaded: hg unavailable.')
    else:
        return True
Пример #10
0
def __virtual__():
    '''
    Only load if svn is installed
    '''
    if utils.which('svn') is None:
        return (False,
                'The svn execution module cannot be loaded: svn unavailable.')
    else:
        return True
Пример #11
0
def __virtual__():
    '''
    Only load if svn is installed
    '''
    if utils.which('svn') is None:
        return (False,
                'The svn execution module cannot be loaded: svn unavailable.')
    else:
        return True
Пример #12
0
def __virtual__():
    if salt.utils.is_windows():
        if utils.which('svn') is None:
            return (False,
                'The svn execution module cannot be loaded: svn unavailable.')
        else:
            return True
    else:
        return (False,
                'This modules only run Windows system.')
Пример #13
0
    def test_salt_with_git_version(self):
        if getattr(self, '_call_binary_', None) is None:
            self.skipTest('\'_call_binary_\' not defined.')
        from salt.utils import which
        from salt.version import __version_info__, SaltStackVersion
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        # Let's get the output of git describe
        process = subprocess.Popen(
            [git, 'describe', '--tags', '--first-parent', '--match', 'v[0-9]*'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True,
            cwd=CODE_DIR
        )
        out, err = process.communicate()
        if process.returncode != 0:
            process = subprocess.Popen(
                [git, 'describe', '--tags', '--match', 'v[0-9]*'],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                close_fds=True,
                cwd=CODE_DIR
            )
            out, err = process.communicate()
        if not out:
            self.skipTest(
                'Failed to get the output of \'git describe\'. '
                'Error: \'{0}\''.format(
                    salt.utils.to_str(err)
                )
            )

        parsed_version = SaltStackVersion.parse(out)

        if parsed_version.info < __version_info__:
            self.skipTest(
                'We\'re likely about to release a new version. This test '
                'would fail. Parsed(\'{0}\') < Expected(\'{1}\')'.format(
                    parsed_version.info, __version_info__
                )
            )
        elif parsed_version.info != __version_info__:
            self.skipTest(
                'In order to get the proper salt version with the '
                'git hash you need to update salt\'s local git '
                'tags. Something like: \'git fetch --tags\' or '
                '\'git fetch --tags upstream\' if you followed '
                'salt\'s contribute documentation. The version '
                'string WILL NOT include the git hash.'
            )
        out = '\n'.join(self.run_script(self._call_binary_, '--version'))
        self.assertIn(parsed_version.string, out)
Пример #14
0
def __get_version_info_from_git(version, version_info):
    '''
    If we can get a version from Git use that instead, otherwise we carry on
    '''
    try:
        from salt.utils import which

        git = which('git')
        if not git:
            return version, version_info

        process = subprocess.Popen(
            [git, 'describe'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True,
            cwd=os.path.abspath(os.path.dirname(__file__))
        )
        out, _ = process.communicate()
        if not out.strip():
            return version, version_info

        match = GIT_DESCRIBE_RE.search(out.strip())
        if not match:
            return version, version_info

        parsed_version = '{0}.{1}.{2}-{3}-{4}'.format(
            match.group('major'),
            match.group('minor'),
            match.group('bugfix'),
            match.group('noc'),
            match.group('sha')
        )
        parsed_version_info = tuple([
            int(g) for g in match.groups()[:3] if g.isdigit()
        ])
        if parsed_version_info != version_info:
            warnings.warn(
                'In order to get the proper salt version with the '
                'git hash you need to update salt\'s local git '
                'tags. Something like: \'git fetch --tags\' or '
                '\'git fetch --tags upstream\' if you followed '
                'salt\'s contribute documentation. The version '
                'string WILL NOT include the git hash.',
                UserWarning,
                stacklevel=2
            )
            return version, version_info
        return parsed_version, parsed_version_info
    except OSError, err:
        if not hasattr(err, 'child_traceback'):
            # This is not an exception thrown within the Popen created child.
            # Let's raise it so it can be catch by the developers
            raise
Пример #15
0
def __virtual__():
	if __grains__.get('os',False) != 'SLES':
		return False
	#if pkg.version('ceph',False) < '0.94':
	if not salt_utils.which('ssh-keygen') :
		log.info('Error ssh-keygen package not find, need to be installed' )
		return False
	if not salt_utils.which('ssh-keyscan') :
		log.info('Error ssh-keyscan package not find, need to be installed' )
		return False
	if not salt_utils.which('sshpass') :
		log.info('Error sshpass package not find, need to be installed' )
		return False
	if not salt_utils.which('lsblk') :
		log.info('Error lsblk package not find, need to be installed' )
		return False
	if not salt_utils.which('iperf3') :
		log.info('Error iperf3 package not find, need to be installed' )
		return False
	return __virtual_name__
Пример #16
0
def __virtual__():
	if __grains__.get('os',False) != 'SLES':
		return False
	#if pkg.version('ceph',False) < '0.94':
	if not salt_utils.which('ssh-keygen') :
		log.info('Error ssh-keygen package not find, need to be installed' )
		return False
	if not salt_utils.which('ssh-keyscan') :
		log.info('Error ssh-keyscan package not find, need to be installed' )
		return False
	if not salt_utils.which('sshpass') :
		log.info('Error sshpass package not find, need to be installed' )
		return False
	if not salt_utils.which('lsblk') :
		log.info('Error lsblk package not find, need to be installed' )
		return False
	if not salt_utils.which('iperf3') :
		log.info('Error iperf3 package not find, need to be installed' )
		return False
	return __virtual_name__
Пример #17
0
    def test_salt_with_git_version(self):
        if getattr(self, '_call_binary_', None) is None:
            self.skipTest('\'_call_binary_\' not defined.')
        from salt.utils import which
        from salt.version import __version_info__
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        # Let's get the output of git describe
        process = subprocess.Popen(
            [git, 'describe'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True,
            cwd=CODE_DIR
        )
        out, err = process.communicate()
        if not out:
            self.skipTest(
                'Failed to get the output of \'git describe\'. '
                'Error: {0!r}'.format(
                    err
                )
            )

        parsed_version = '{0}'.format(out.strip().lstrip('v'))
        parsed_version_info = tuple([
            int(i) for i in parsed_version.split('-', 1)[0].split('.')
        ])
        if parsed_version_info and parsed_version_info < __version_info__:
            self.skipTest(
                'We\'re likely about to release a new version. '
                'This test would fail. Parsed({0!r}) < Expected({1!r})'.format(
                    parsed_version_info, __version_info__
                )
            )
        elif parsed_version_info != __version_info__:
            self.skipTest(
                'In order to get the proper salt version with the '
                'git hash you need to update salt\'s local git '
                'tags. Something like: \'git fetch --tags\' or '
                '\'git fetch --tags upstream\' if you followed '
                'salt\'s contribute documentation. The version '
                'string WILL NOT include the git hash.'
            )
        out = '\n'.join(self.run_script(self._call_binary_, '--version'))
        self.assertIn(parsed_version, out)
Пример #18
0
def __get_version_info_from_git():
    '''
    If we can get a version from Git use that instead, otherwise we carry on
    '''
    try:
        from salt.utils import which

        git = which('git')
        if git:
            process = subprocess.Popen(
                [git, 'describe'],
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                close_fds=True,
                cwd=os.path.abspath(os.path.dirname(__file__))
            )
            out, _ = process.communicate()
            if out:
                parsed_version = '{0}'.format(out.strip().lstrip('v'))
                parsed_version_info = tuple([
                    int(i) for i in parsed_version.split('-', 1)[0].split('.')
                ])
                if parsed_version_info != __version_info__:
                    msg = ('In order to get the proper salt version with the '
                           'git hash you need to update salt\'s local git '
                           'tags. Something like: \'git fetch --tags\' or '
                           '\'git fetch --tags upstream\' if you followed '
                           'salt\'s contribute documentation. The version '
                           'string WILL NOT include the git hash.')
                    from salt import log
                    if log.is_console_configured():
                        import logging
                        logging.getLogger(__name__).warning(msg)
                    else:
                        sys.stderr.write('WARNING: {0}\n'.format(msg))
                else:
                    __version__ = parsed_version
                    __version_info__ = parsed_version_info
    except Exception:
        pass
Пример #19
0
    def test_salt_with_git_version(self):
        if getattr(self, '_call_binary_', None) is None:
            self.skipTest('\'_call_binary_\' not defined.')
        from salt.utils import which
        from salt.version import __version_info__
        git = which('git')
        if not git:
            self.skipTest('The git binary is not available')

        # Let's get the output of git describe
        process = subprocess.Popen([git, 'describe'],
                                   stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
                                   close_fds=True,
                                   cwd=CODE_DIR)
        out, err = process.communicate()
        if not out:
            self.skipTest('Failed to get the output of \'git describe\'. '
                          'Error: {0!r}'.format(err))

        parsed_version = '{0}'.format(out.strip().lstrip('v'))
        parsed_version_info = tuple(
            [int(i) for i in parsed_version.split('-', 1)[0].split('.')])
        if parsed_version_info and parsed_version_info < __version_info__:
            self.skipTest(
                'We\'re likely about to release a new version. '
                'This test would fail. Parsed({0!r}) < Expected({1!r})'.format(
                    parsed_version_info, __version_info__))
        elif parsed_version_info != __version_info__:
            self.skipTest('In order to get the proper salt version with the '
                          'git hash you need to update salt\'s local git '
                          'tags. Something like: \'git fetch --tags\' or '
                          '\'git fetch --tags upstream\' if you followed '
                          'salt\'s contribute documentation. The version '
                          'string WILL NOT include the git hash.')
        out = '\n'.join(self.run_script(self._call_binary_, '--version'))
        self.assertIn(parsed_version, out)
Пример #20
0
# pylint: disable=import-error
from helper import _run
log = logging.getLogger(__name__)

try:
    from salt.utils import which
except ImportError:
    from distutils.spawn import which

try:
    # pylint: disable=import-error,3rd-party-module-not-gated,redefined-builtin
    from salt.ext.six.moves import range
except ImportError:
    logging.error("Could not import salt.ext.six.moves -> range")

IPERF_PATH = which('iperf3')

LOCALHOST_NAME = socket.gethostname()
'''
multi is the module to call subprocess in minion host

Ping is a simple test to check if point to point nodes are connected

CLI Example:
.. code-block:: bash
    sudo salt 'node' multi.ping_cmd <hostname>|<ip>
    sudo salt 'node' multi.ping <hostname>|<ip> <hostname>|<ip>....
'''


def _all(func, hosts):
Пример #21
0
def __virtual__():
    '''
    Only load if lpadmin exists on the system
    '''
    return True if utils.which('lpadmin') else False
Пример #22
0
# Import salt libs
from salt import utils

__virtualname__ = 'trafficserver'

log = logging.getLogger(__name__)


def __virtual__():
    if utils.which('traffic_ctl') or utils.which('traffic_line'):
        return __virtualname__
    return (False, 'trafficserver execution module not loaded: '
            'neither traffic_ctl nor traffic_line was found.')


_TRAFFICLINE = utils.which('traffic_line')
_TRAFFICCTL = utils.which('traffic_ctl')


def _traffic_ctl(*args):
    return ' '.join([_TRAFFICCTL] + args)


def _traffic_line(*args):
    return ' '.join([_TRAFFICLINE] + args)


def _statuscmd():
    if _TRAFFICCTL:
        cmd = _traffic_ctl('server', 'status')
    else:
Пример #23
0
def __virtual__():
    """
    Only load if grunt cli is available.
    """
    return utils.which('grunt') is not None
Пример #24
0
import logging
import subprocess

# Import salt libs
from salt import utils

__virtualname__ = 'trafficserver'

log = logging.getLogger(__name__)


def __virtual__():
    return __virtualname__ if utils.which('traffic_line') else False


_TRAFFICLINE = utils.which('traffic_line')


def _subprocess(cmd):
    '''
    Function to standardize the subprocess call
    '''

    try:
        proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
        ret = utils.to_str(proc.communicate()[0]).strip()
        retcode = proc.wait()

        if ret:
            return ret
        elif retcode != 1:
Пример #25
0
def __virtual__():
    """
    Only return if maven is installed
    """
    return 'maven' if which('mvn') else False
Пример #26
0
def __virtual__():
    '''
    Only load if mercurial is available on the system
    '''
    return bool(utils.which('hg'))
Пример #27
0
# -*- coding: utf-8 -*-
"""
Nginx Security Benchmark module
"""

import re
import logging
from salt import utils
from distutils.version import LooseVersion
import os.path


__virtualname__ = 'nginx_se'
__outputter__ = {'run': 'nested'}

GREP = utils.which('egrep')
CHAGE = utils.which('chage')
RPMQUERY = utils.which('rpm')
STAT = utils.which('stat')
if utils.which('chkconfig'):
    CHKCONFIG = utils.which('chkconfig')
if utils.which('systemctl'):
    CHKCONFIG = utils.which('systemctl')

PASSED = 'Passed'
FAILED = 'Failed'
UNKNOWN = 'Unknown'
NGINX_CONFIG_FILE = '/etc/nginx/nginx.conf'
PHP_CONFIG_FILE = '/etc/php.ini'
KEYS_MAP = {
    'id': 'id',
Пример #28
0
'''

# Import Python libs
import sys

__version_info__ = (0, 10, 5)
__version__ = '.'.join(map(str, __version_info__))


# If we can get a version from Git use that instead, otherwise carry on
try:
    import os
    import subprocess
    from salt.utils import which

    git = which('git')
    if git:
        p = subprocess.Popen(
            [git, 'describe'],
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True,
            cwd=os.path.abspath(os.path.dirname(__file__))
        )
        out, err = p.communicate()
        if out:
            parsed_version = '{0}'.format(out.strip().lstrip('v'))
            parsed_version_info = tuple(
                [int(i) for i in parsed_version.split('-', 1)[0].split('.')]
            )
            if parsed_version_info != __version_info__:
Пример #29
0
Файл: oscap.py Проект: viq/Nova
'''
from __future__ import absolute_import

# Import python libs
import logging

# Import salt libs
from salt.ext.six.moves.urllib.parse import urlparse  # pylint: disable=no-name-in-module
from salt import utils

__virtualname__ = 'oscap'

log = logging.getLogger(__name__)

_OSCAP = utils.which('oscap')


def __virtual__():
    '''
    Compatible with Linux & requires oscap binary
    '''
    return True


def scan(filename):
    '''
    scan function
    '''
    parsed = urlparse(filename)
    if not parsed.scheme:
Пример #30
0
def __virtual__():
    """
    Only return if ivy is installed
    """
    return 'aurora' if which('aurora') else False
Пример #31
0
 def is_ha_node(self):
     if which("pacemakerd") and which("corosync"):
         return True
     return False
Пример #32
0
def __virtual__():
    """
    Only return if fig is installed
    """
    return 'docker-compose' if which('fig') else False
Пример #33
0
def __virtual__():
    """
    Only return if deis is installed
    """
    return 'deis' if which('deis') else False
Пример #34
0
__version_info__ = (0, 7, 5)
__version__ = '.'.join(map(str, __version_info__))

# If we can get a version from Git use that instead, otherwise carry on
try:
    import subprocess
    from salt.utils import which

    git = which('git')
    if git:
        p = subprocess.Popen([git, 'describe'],
                stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
        out, err = p.communicate()
        if out:
            __version__ = '{0}'.format(out.strip().lstrip('v'))
            __version_info__ = tuple(__version__.split('-', 1)[0].split('.'))
except Exception:
    pass

if __name__ == '__main__':
    print(__version__)
Пример #35
0
def __virtual__():
    '''
    Only load if lpadmin exists on the system
    '''
    return True if utils.which('lpadmin') else False
Пример #36
0
def __virtual__():
    return __virtualname__ if utils.which('traffic_line') else False
Пример #37
0
 def setUpClass(cls):
     from salt.utils import which
     git = which('git')
     if not git:
         self.skipTest('The git binary is not available')
Пример #38
0
import logging
import multiprocessing.dummy
import multiprocessing
import re
import socket
from subprocess import Popen, PIPE

log = logging.getLogger(__name__)

try:
    from salt.utils import which
except:
    from distutils.spawn import which

iperf_path = which('iperf3')

localhost_name = socket.gethostname()
'''
multi is the module to call subprocess in minion host

Ping is a simple test to check if point to point nodes are connected

CLI Example:
.. code-block:: bash
    sudo salt 'node' multi.ping_cmd <hostname>|<ip>
    sudo salt 'node' multi.ping <hostname>|<ip> <hostname>|<ip>....
'''


def _all(func, hosts):
Пример #39
0
def __virtual__():
    return __virtualname__ if utils.which('traffic_line') else False
Пример #40
0
from subprocess import PIPE, Popen

# salt libs
# import salt.client
# import salt.utils

__virtual_name__ = 'lttng'

log = logging.getLogger(__name__)

try:
    from salt.utils import which
except:
    from distutils.spawn import which

lttng_bin = which('lttng')

# shell = 'cmd.run'
shell = 'cmd.shell'

if lttng_bin is None:
    log.error("Error: could not find lttng on path")

lttng_run_path = '/var/run/lttng/'
lttng_output_path = lttng_run_path + 'output/'


def __virtual__():
    if not lttng_bin:
        return False
    return __virtual_name__
Пример #41
0
# Import salt libs
from salt import utils

__virtualname__ = 'trafficserver'

log = logging.getLogger(__name__)


def __virtual__():
    if utils.which('traffic_line'):
        return __virtualname__
    return (False, 'trafficserver execution module not loaded: '
            'traffic_line command not found.')


_TRAFFICLINE = utils.which('traffic_line')


def _subprocess(cmd):
    '''
    Function to standardize the subprocess call
    '''

    try:
        proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
        ret = utils.to_str(proc.communicate()[0]).strip()
        retcode = proc.wait()

        if ret:
            return ret
        elif retcode != 1:
Пример #42
0
def __virtual__():
    if utils.which('traffic_ctl') or utils.which('traffic_line'):
        return __virtualname__
    return (False, 'trafficserver execution module not loaded: '
            'neither traffic_ctl nor traffic_line was found.')
Пример #43
0
def __virtual__():
    if utils.which('traffic_line'):
        return __virtualname__
    return (False, 'trafficserver execution module not loaded: '
            'traffic_line command not found.')
Пример #44
0
def __virtual__():
    '''
    Only load if git exists on the system
    '''
    return True if utils.which('git') else False
Пример #45
0
def __virtual__():
    '''
    Only load if git exists on the system
    '''
    return True if utils.which('git') else False
Пример #46
0
def __virtual__():
    """
    Only return if ivy is installed
    """
    return 'aurora' if which('aurora') else False
Пример #47
0
# -*- coding: utf-8 -*-
"""
Add, modify, remove queues from the Common Unix Printing System
"""

import re
import logging
from salt.utils import which

log = logging.getLogger(__name__)

lpadmin_path = which('lpadmin')
lpstat_path = which('lpstat')
lpinfo_path = which('lpinfo')
lpoptions_path = which('lpoptions')

__virtualname__ = 'cups'

def __virtual__():
    '''
    Only load if lpadmin exists on the system
    '''
    if not lpadmin_path:
        log.warning("cups module not loading because lpadmin not found in path")
        return False
    else:
        log.info("cups module is available at path: {}".format(lpadmin_path))
        return __virtualname__


def printers():