示例#1
0
def create(path,
           venv_bin=__opts__['venv_bin'],
           no_site_packages=False,
           system_site_packages=False,
           distribute=False,
           clear=False,
           python='',
           extra_search_dir='',
           never_download=False,
           prompt='',
           runas=None):
    '''
    Create a virtualenv

    path
        The path to create the virtualenv
    venv_bin : 'virtualenv'
        The name (and optionally path) of the virtualenv command. This can also
        be set globally in the minion config file as ``virtualenv.venv_bin``.
    no_site_packages : False
        Passthrough argument given to virtualenv
    system_site_packages : False
        Passthrough argument given to virtualenv
    distribute : False
        Passthrough argument given to virtualenv
    clear : False
        Passthrough argument given to virtualenv
    python : (default)
        Passthrough argument given to virtualenv
    extra_search_dir : (default)
        Passthrough argument given to virtualenv
    never_download : (default)
        Passthrough argument given to virtualenv
    prompt : (default)
        Passthrough argument given to virtualenv
    runas : None
        Set ownership for the virtualenv

    CLI Example::

        salt '*' virtualenv.create /path/to/new/virtualenv
    '''
    # raise CommandNotFoundError if venv_bin is missing
    utils.check_or_die(venv_bin)

    cmd = '{venv_bin} {args} {path}'.format(
        venv_bin=venv_bin,
        args=''.join([
            ' --no-site-packages' if no_site_packages else '',
            ' --system-site-packages' if system_site_packages else '',
            ' --distribute' if distribute else '', ' --clear' if clear else '',
            ' --python {0}'.format(python) if python else '',
            ' --extra-search-dir {0}'.format(extra_search_dir)
            if extra_search_dir else '',
            ' --never-download' if never_download else '',
            ' --prompt {0}'.format(prompt) if prompt else ''
        ]),
        path=path)

    return __salt__['cmd.run'](cmd, runas=runas)
示例#2
0
文件: virtualenv.py 项目: cmek/salt
def create(path,
        venv_bin=__opts__['venv_bin'],
        no_site_packages=False,
        system_site_packages=False,
        distribute=False,
        clear=False,
        python='',
        extra_search_dir='',
        never_download=False,
        prompt='',
        runas=None):
    '''
    Create a virtualenv

    path
        The path to create the virtualenv
    venv_bin : 'virtualenv'
        The name (and optionally path) of the virtualenv command. This can also
        be set globally in the minion config file as ``virtualenv.venv_bin``.
    no_site_packages : False
        Passthrough argument given to virtualenv
    system_site_packages : False
        Passthrough argument given to virtualenv
    distribute : False
        Passthrough argument given to virtualenv
    clear : False
        Passthrough argument given to virtualenv
    python : (default)
        Passthrough argument given to virtualenv
    extra_search_dir : (default)
        Passthrough argument given to virtualenv
    never_download : (default)
        Passthrough argument given to virtualenv
    prompt : (default)
        Passthrough argument given to virtualenv
    runas : None
        Set ownership for the virtualenv

    CLI Example::

        salt '*' pip.virtualenv /path/to/new/virtualenv
    '''
    # raise CommandNotFoundError if venv_bin is missing
    utils.check_or_die(venv_bin)

    cmd = '{venv_bin} {args} {path}'.format(
            venv_bin=venv_bin,
            args=''.join([
                ' --no-site-packages' if no_site_packages else '',
                ' --system-site-packages' if system_site_packages else '',
                ' --distribute' if distribute else '',
                ' --clear' if clear else '',
                ' --python {0}'.format(python) if python else '',
                ' --extra-search-dir {0}'.format(extra_search_dir
                    ) if extra_search_dir else '',
                ' --never-download' if never_download else '',
                ' --prompt {0}'.format(prompt) if prompt else '']),
            path=path)

    return __salt__['cmd.run'](cmd, runas=runas)
示例#3
0
文件: upstart.py 项目: nkhuyu/salt
def _get_service_exec():
    '''
    Debian uses update-rc.d to manage System-V style services.
    http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.3.3
    '''
    executable = 'update-rc.d'
    utils.check_or_die(executable)
    return executable
示例#4
0
文件: puppet.py 项目: vitorarins/salt
def _check_puppet():
    '''
    Checks if puppet is installed
    '''
    # I thought about making this a virtual module, but then I realized that I
    # would require the minion to restart if puppet was installed after the
    # minion was started, and that would be rubbish
    utils.check_or_die('puppet')
示例#5
0
文件: upstart.py 项目: Adapptor/salt
def _get_service_exec():
    '''
    Debian uses update-rc.d to manage System-V style services.
    http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.3.3
    '''
    executable = 'update-rc.d'
    utils.check_or_die(executable)
    return executable
示例#6
0
def _check_puppet():
    '''
    Checks if puppet is installed
    '''
    # I thought about making this a virtual module, but then I realized that I
    # would require the minion to restart if puppet was installed after the
    # minion was started, and that would be rubbish
    utils.check_or_die('puppet')
示例#7
0
文件: npm.py 项目: Katafalkas/states
def __virtual__():
    '''
    Verify npm is installed.
    '''
    try:
        utils.check_or_die('npm')
        return 'npm'
    except exceptions.CommandNotFoundError:
        return False
示例#8
0
def __virtual__():
    '''
    Verify apt is installed.
    '''
    try:
        utils.check_or_die('apt-key')
        return 'apt_repository'
    except exceptions.CommandNotFoundError:
        return False
示例#9
0
文件: rabbitmq.py 项目: herlo/salt
def __virtual__():
    '''Verify RabbitMQ is installed.
    '''
    name = 'rabbitmq'
    try:
        utils.check_or_die('rabbitmqctl')
    except exceptions.CommandNotFoundError:
        name = False
    return name
示例#10
0
def __virtual__():
    '''
    Only load this module if the psql bin exists
    '''
    try:
        check_or_die('psql')
        return 'postgres'
    except CommandNotFoundError:
        return False
示例#11
0
def __virtual__():
    '''
    Verify that tc (iproute) is installed
    '''
    try:
        utils.check_or_die('tc')
        return 'shaping'
    except:
        return False
示例#12
0
def __virtual__():
    '''
    Only load this module if the psql bin exists
    '''
    try:
        check_or_die('psql')
        return 'postgres'
    except CommandNotFoundError:
        return False
示例#13
0
def __virtual__():
    '''Verify RabbitMQ is installed.
    '''
    name = 'rabbitmq'
    try:
        utils.check_or_die('rabbitmqctl')
    except exceptions.CommandNotFoundError:
        name = False
    return name
示例#14
0
def __virtual__():
    '''
    Verify apt is installed.
    '''
    try:
        utils.check_or_die('apt-key')
        return 'apt_repository'
    except exceptions.CommandNotFoundError:
        return False
示例#15
0
文件: postgres.py 项目: rooprob/salt
def __virtual__():
    """
    Only load this module if the psql bin exists
    """
    try:
        check_or_die("psql")
        return "postgres"
    except CommandNotFoundError:
        return False
示例#16
0
def __virtual__():
    '''
    Check for supervisor.
    '''
    try:
        utils.check_or_die('supervisorctl')
    except exceptions.CommandNotFoundError:
        return False

    return 'supervisord'
示例#17
0
def __virtual__():
    '''
    Check for supervisor.
    '''
    try:
        utils.check_or_die('supervisorctl')
    except exceptions.CommandNotFoundError:
        return False

    return 'supervisord'
示例#18
0
def __virtual__():
    """
    Only load if RabbitMQ is installed.
    """
    name = "rabbitmq_policy"
    try:
        utils.check_or_die("rabbitmqctl")
    except exceptions.CommandNotFoundError:
        name = False
    return name
示例#19
0
def __virtual__():
    """
    Check for supervisor.
    """
    try:
        utils.check_or_die("supervisorctl")
    except exceptions.CommandNotFoundError:
        return False

    return "supervisord"
示例#20
0
def __virtual__():
    '''
    Verify PyRabbit and RabbitMQ are installed.
    '''
    try:
        utils.check_or_die('rabbitmqctl')
        log.debug("rabbitmqctl is available")
    except exceptions.CommandNotFoundError:
        log.error("rabbitmqctl is not available")
        name = False
    if not has_pyrabbit:
        log.error("pyrabbit is not available")
    return 'rabbitmq_cluster'
示例#21
0
def __virtual__():
    '''
    Verify PyRabbit and RabbitMQ are installed.
    '''
    try:
        utils.check_or_die('rabbitmqctl')
        log.debug("rabbitmqctl is available")
    except exceptions.CommandNotFoundError:
        log.error("rabbitmqctl is not available")
        name = False
    if not has_pyrabbit:
        log.error("pyrabbit is not available")
    return 'rabbitmq_cluster'
示例#22
0
def __virtual__():
    '''
    Verify PyRabbit and RabbitMQ are installed.
    '''
    command = 'rabbitmqctl'
    try:
        utils.check_or_die(command)
    except exceptions.CommandNotFoundError:
        log.debug("Can't find command '%s'", command)
        return False
    if not has_pyrabbit:
        log.debug("Can't find python module 'pyrabbit'")
        return False
    return 'rabbitmq_cluster'
示例#23
0
文件: hg.py 项目: micahhausler/salt
def _check_hg():
    utils.check_or_die(hg_binary)
示例#24
0
文件: svn.py 项目: yanghao-zh/salt
def _check_svn():
    '''
    Check for svn on this node.
    '''
    utils.check_or_die('svn')
示例#25
0
def _check_bzr():
    utils.check_or_die('bzr')
示例#26
0
文件: svn.py 项目: 1mentat/salt
def _check_svn():
    '''
    Check for svn on this node.
    '''
    utils.check_or_die('svn')
示例#27
0
文件: upstart.py 项目: jhutchins/salt
def _get_service_exec():
    executable = 'update-rc.d'
    utils.check_or_die(executable)
    return executable
示例#28
0
文件: hg.py 项目: inthecloud247/salt
def _check_hg():
    utils.check_or_die('hg')
示例#29
0
文件: hg.py 项目: MadeiraCloud/salt
def _check_hg():
    utils.check_or_die(hg_binary)
示例#30
0
def _check_bzr():
    utils.check_or_die('bzr')
示例#31
0
def _check_facter():
    '''
    Checks if facter is installed
    '''
    utils.check_or_die('facter')
示例#32
0
文件: git.py 项目: DamianZaremba/salt
def _check_git():
    utils.check_or_die('git')
示例#33
0
文件: git.py 项目: swdream/salt-1
def _check_git():
    '''
    Check if git is available
    '''
    utils.check_or_die('git')
示例#34
0
文件: git.py 项目: sijis/salt
def _check_git():
    """
    Check if git is available
    """
    utils.check_or_die("git")
示例#35
0
文件: puppet.py 项目: vitorarins/salt
def _check_facter():
    '''
    Checks if facter is installed
    '''
    utils.check_or_die('facter')
示例#36
0
def _check_git():
    utils.check_or_die('git')
示例#37
0
def _check_hg():
    utils.check_or_die('hg')
示例#38
0
def __virtual__():
    try:
        check_or_die('nginx')
    except CommandNotFoundError:
        return False
    return 'nginx_site'
示例#39
0
def _check_git():
    '''
    Check if git is available
    '''
    utils.check_or_die('git')
示例#40
0
def _check_aws():
    '''
    Make sure awscli is installed
    '''
    utils.check_or_die('aws')
    return 'aws_sqs'