Exemple #1
0
 def run(self, *args, **kwargs):
     buildout_directory = get_buildout_directory(api.env.host)
     buildout = get_buildout_config(
         os.path.join(buildout_directory, 'buildout.cfg')
     )
     keys = api.env.keys()
     config = dict([
         (key.replace('-', '_'), value) for key, value
         in buildout.get('aja', {}).items() if key in keys
     ])
     if 'host_string' in config:
         config.update(parse_host_string(config.get('host_string')))
     config['buildout'] = buildout
     directory = buildout.get('buildout', {}).get('directory')
     with settings(**config):
         with lcd(directory):
             return self.func(*args, **kwargs)
Exemple #2
0
def ssh(*cmd):
    """
    Open an interactive ssh session
    """
    run = ['ssh', '-A', '-t']
    if env.key_filename:
        if isinstance(env.key_filename, list):
            key_filename = env.key_filename[0]
        else:
            key_filename = env.key_filename
        run.extend(["-i", os.path.expanduser(key_filename)])
    parsed = parse_host_string(env.host_string)
    if parsed['port']:
        run.extend(['-p', parsed['port']])
    else:
        run.extend(['-p', unicode(env.port)])
    user = parsed['user'] if parsed['user'] else env.user
    run.append('%s@%s' % (parsed['user'] if parsed['user'] else env.user, parsed['host']))
    run += cmd
    subprocess.call(run)
Exemple #3
0
def ssh(*cmd):
    """
    Open an interactive ssh session
    """
    run = ["ssh", "-A", "-t"]
    if env.key_filename:
        if isinstance(env.key_filename, list):
            key_filename = env.key_filename[0]
        else:
            key_filename = env.key_filename
        run.extend(["-i", os.path.expanduser(key_filename)])
    parsed = parse_host_string(env.host_string)
    if parsed["port"]:
        run.extend(["-p", parsed["port"]])
    else:
        run.extend(["-p", unicode(env.port)])
    user = parsed["user"] if parsed["user"] else env.user
    run.append("%s@%s" % (parsed["user"] if parsed["user"] else env.user, parsed["host"]))
    run += cmd
    subprocess.call(run)
Exemple #4
0
def ssh(*cmd):
    """
    Open an interactive ssh session
    """
    run = ['ssh', '-A', '-t']
    if env.key_filename:
        if isinstance(env.key_filename, list):
            key_filename = env.key_filename[0]
        else:
            key_filename = env.key_filename
        run.extend(["-i", os.path.expanduser(key_filename)])
    parsed = parse_host_string(env.host_string)
    if parsed['port']:
        run.extend(['-p', parsed['port']])
    else:
        run.extend(['-p', unicode(env.port)])
    user = parsed['user'] if parsed['user'] else env.user
    run.append(
        '%s@%s' %
        (parsed['user'] if parsed['user'] else env.user, parsed['host']))
    run += cmd
    subprocess.call(run)
Exemple #5
0
 def get_hosts(self):
     return [
         parse_host_string(host_string)['host']
         for host_string in env.roledefs[self.role]
     ]
Exemple #6
0
 def get_hosts(self):
     return [
         parse_host_string(host_string)['host']
         for host_string in env.roledefs[self.role]
     ]