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

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

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

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