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)
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)
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)
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)
def get_hosts(self): return [ parse_host_string(host_string)['host'] for host_string in env.roledefs[self.role] ]