def cmd_ssh(argv, args): """ Usage: localstack ssh [options] Commands: ssh Obtain a shell in the running LocalStack container Options: """ bootstrap.bootstrap_installation() from localstack.utils.common import run args.update(docopt(cmd_ssh.__doc__.strip(), argv=argv)) lines = run('docker ps').split('\n')[1:] lines = [l for l in lines if 'localstack' in l] if len(lines) != 1: raise Exception( 'Expected 1 running "localstack" container, but found %s' % 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
import sys import glob import time import shutil import logging import tempfile from localstack import config from localstack.utils import bootstrap from localstack.constants import ( DEFAULT_SERVICE_PORTS, ELASTICMQ_JAR_URL, STS_JAR_URL, ELASTICSEARCH_URLS, ELASTICSEARCH_DEFAULT_VERSION, ELASTICSEARCH_PLUGIN_LIST, ELASTICSEARCH_DELETE_MODULES, DYNAMODB_JAR_URL, DYNAMODB_JAR_URL_ALPINE, LOCALSTACK_MAVEN_VERSION, STEPFUNCTIONS_ZIP_URL, KMS_URL_PATTERN, LOCALSTACK_INFRA_PROCESS) if __name__ == '__main__': bootstrap.bootstrap_installation() # flake8: noqa: E402 from localstack.utils.common import (download, parallelize, run, mkdir, load_file, save_file, unzip, untar, rm_rf, chmod_r, is_aarch64, is_alpine, in_docker, get_arch, new_tmp_file) THIS_PATH = os.path.dirname(os.path.realpath(__file__)) ROOT_PATH = os.path.realpath(os.path.join(THIS_PATH, '..')) INSTALL_DIR_INFRA = '%s/infra' % ROOT_PATH INSTALL_DIR_NPM = '%s/node_modules' % ROOT_PATH INSTALL_DIR_DDB = '%s/dynamodb' % INSTALL_DIR_INFRA INSTALL_DIR_KCL = '%s/amazon-kinesis-client' % INSTALL_DIR_INFRA INSTALL_DIR_STEPFUNCTIONS = '%s/stepfunctions' % INSTALL_DIR_INFRA INSTALL_DIR_KMS = '%s/kms' % INSTALL_DIR_INFRA