Пример #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
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
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
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
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
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
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
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
def _check_hg():
    utils.check_or_die(hg_binary)
Пример #24
0
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
def _check_svn():
    '''
    Check for svn on this node.
    '''
    utils.check_or_die('svn')
Пример #27
0
def _get_service_exec():
    executable = 'update-rc.d'
    utils.check_or_die(executable)
    return executable
Пример #28
0
def _check_hg():
    utils.check_or_die('hg')
Пример #29
0
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
def _check_git():
    utils.check_or_die('git')
Пример #33
0
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
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'