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)
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)
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
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')
def __virtual__(): ''' Verify npm is installed. ''' try: utils.check_or_die('npm') return 'npm' except exceptions.CommandNotFoundError: return False
def __virtual__(): ''' Verify apt is installed. ''' try: utils.check_or_die('apt-key') return 'apt_repository' except exceptions.CommandNotFoundError: return False
def __virtual__(): '''Verify RabbitMQ is installed. ''' name = 'rabbitmq' try: utils.check_or_die('rabbitmqctl') except exceptions.CommandNotFoundError: name = False return name
def __virtual__(): ''' Only load this module if the psql bin exists ''' try: check_or_die('psql') return 'postgres' except CommandNotFoundError: return False
def __virtual__(): ''' Verify that tc (iproute) is installed ''' try: utils.check_or_die('tc') return 'shaping' except: return False
def __virtual__(): """ Only load this module if the psql bin exists """ try: check_or_die("psql") return "postgres" except CommandNotFoundError: return False
def __virtual__(): ''' Check for supervisor. ''' try: utils.check_or_die('supervisorctl') except exceptions.CommandNotFoundError: return False return 'supervisord'
def __virtual__(): """ Only load if RabbitMQ is installed. """ name = "rabbitmq_policy" try: utils.check_or_die("rabbitmqctl") except exceptions.CommandNotFoundError: name = False return name
def __virtual__(): """ Check for supervisor. """ try: utils.check_or_die("supervisorctl") except exceptions.CommandNotFoundError: return False return "supervisord"
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'
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'
def _check_hg(): utils.check_or_die(hg_binary)
def _check_svn(): ''' Check for svn on this node. ''' utils.check_or_die('svn')
def _check_bzr(): utils.check_or_die('bzr')
def _get_service_exec(): executable = 'update-rc.d' utils.check_or_die(executable) return executable
def _check_hg(): utils.check_or_die('hg')
def _check_facter(): ''' Checks if facter is installed ''' utils.check_or_die('facter')
def _check_git(): utils.check_or_die('git')
def _check_git(): ''' Check if git is available ''' utils.check_or_die('git')
def _check_git(): """ Check if git is available """ utils.check_or_die("git")
def __virtual__(): try: check_or_die('nginx') except CommandNotFoundError: return False return 'nginx_site'
def _check_aws(): ''' Make sure awscli is installed ''' utils.check_or_die('aws') return 'aws_sqs'