Exemple #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)
Exemple #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)
Exemple #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
Exemple #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')
Exemple #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
Exemple #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')
Exemple #7
0
def __virtual__():
    '''
    Verify npm is installed.
    '''
    try:
        utils.check_or_die('npm')
        return 'npm'
    except exceptions.CommandNotFoundError:
        return False
Exemple #8
0
def __virtual__():
    '''
    Verify apt is installed.
    '''
    try:
        utils.check_or_die('apt-key')
        return 'apt_repository'
    except exceptions.CommandNotFoundError:
        return False
Exemple #9
0
def __virtual__():
    '''Verify RabbitMQ is installed.
    '''
    name = 'rabbitmq'
    try:
        utils.check_or_die('rabbitmqctl')
    except exceptions.CommandNotFoundError:
        name = False
    return name
Exemple #10
0
def __virtual__():
    '''
    Only load this module if the psql bin exists
    '''
    try:
        check_or_die('psql')
        return 'postgres'
    except CommandNotFoundError:
        return False
Exemple #11
0
def __virtual__():
    '''
    Verify that tc (iproute) is installed
    '''
    try:
        utils.check_or_die('tc')
        return 'shaping'
    except:
        return False
Exemple #12
0
def __virtual__():
    '''
    Only load this module if the psql bin exists
    '''
    try:
        check_or_die('psql')
        return 'postgres'
    except CommandNotFoundError:
        return False
Exemple #13
0
def __virtual__():
    '''Verify RabbitMQ is installed.
    '''
    name = 'rabbitmq'
    try:
        utils.check_or_die('rabbitmqctl')
    except exceptions.CommandNotFoundError:
        name = False
    return name
Exemple #14
0
def __virtual__():
    '''
    Verify apt is installed.
    '''
    try:
        utils.check_or_die('apt-key')
        return 'apt_repository'
    except exceptions.CommandNotFoundError:
        return False
Exemple #15
0
def __virtual__():
    """
    Only load this module if the psql bin exists
    """
    try:
        check_or_die("psql")
        return "postgres"
    except CommandNotFoundError:
        return False
Exemple #16
0
def __virtual__():
    '''
    Check for supervisor.
    '''
    try:
        utils.check_or_die('supervisorctl')
    except exceptions.CommandNotFoundError:
        return False

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

    return 'supervisord'
Exemple #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
Exemple #19
0
def __virtual__():
    """
    Check for supervisor.
    """
    try:
        utils.check_or_die("supervisorctl")
    except exceptions.CommandNotFoundError:
        return False

    return "supervisord"
Exemple #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'
Exemple #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'
Exemple #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'
Exemple #23
0
def _check_hg():
    utils.check_or_die(hg_binary)
Exemple #24
0
def _check_svn():
    '''
    Check for svn on this node.
    '''
    utils.check_or_die('svn')
Exemple #25
0
def _check_bzr():
    utils.check_or_die('bzr')
Exemple #26
0
def _check_svn():
    '''
    Check for svn on this node.
    '''
    utils.check_or_die('svn')
Exemple #27
0
def _get_service_exec():
    executable = 'update-rc.d'
    utils.check_or_die(executable)
    return executable
Exemple #28
0
def _check_hg():
    utils.check_or_die('hg')
Exemple #29
0
def _check_hg():
    utils.check_or_die(hg_binary)
Exemple #30
0
def _check_bzr():
    utils.check_or_die('bzr')
Exemple #31
0
def _check_facter():
    '''
    Checks if facter is installed
    '''
    utils.check_or_die('facter')
Exemple #32
0
def _check_git():
    utils.check_or_die('git')
Exemple #33
0
def _check_git():
    '''
    Check if git is available
    '''
    utils.check_or_die('git')
Exemple #34
0
def _check_git():
    """
    Check if git is available
    """
    utils.check_or_die("git")
Exemple #35
0
def _check_facter():
    '''
    Checks if facter is installed
    '''
    utils.check_or_die('facter')
Exemple #36
0
def _check_git():
    utils.check_or_die('git')
Exemple #37
0
def _check_hg():
    utils.check_or_die('hg')
Exemple #38
0
def __virtual__():
    try:
        check_or_die('nginx')
    except CommandNotFoundError:
        return False
    return 'nginx_site'
Exemple #39
0
def _check_git():
    '''
    Check if git is available
    '''
    utils.check_or_die('git')
Exemple #40
0
def _check_aws():
    '''
    Make sure awscli is installed
    '''
    utils.check_or_die('aws')
    return 'aws_sqs'