def cmd_ssh(argv, args): """ Usage: localstack ssh [options] Commands: ssh Obtain a shell in the running LocalStack container Options: """ args.update(docopt(cmd_ssh.__doc__.strip(), argv=argv)) lines = to_str(run('docker ps')).split('\n')[1:] lines = [l for l in lines if MAIN_CONTAINER_NAME in l] if len(lines) != 1: raise Exception('Expected 1 running "%s" container, but found %s' % (MAIN_CONTAINER_NAME, len(lines))) cid = re.split(r'\s', lines[0])[0] try: process = run('docker exec -it %s bash' % cid, tty=True) process.wait() except KeyboardInterrupt: pass
def cmd_ssh(argv, args): """ Usage: localstack ssh [options] Commands: ssh Obtain a shell in the running LocalStack container Options: """ args.update(docopt(cmd_ssh.__doc__.strip(), argv=argv)) if not docker_container_running(config.MAIN_CONTAINER_NAME): raise Exception('Expected 1 running "%s" container, but found none' % config.MAIN_CONTAINER_NAME) try: process = run('docker exec -it %s bash' % config.MAIN_CONTAINER_NAME, tty=True) process.wait() except KeyboardInterrupt: pass
def do_run(cmd): return bootstrap.run(cmd, **kwargs)