Implement --stay-attached
This commit is contained in:
parent
af6d755036
commit
ef72e885d7
@ -61,7 +61,7 @@ def create_deploy_context(global_context, stack, include, exclude, cluster, env_
|
||||
return DeployCommandContext(cluster_context, docker)
|
||||
|
||||
|
||||
def up_operation(ctx, services_list):
|
||||
def up_operation(ctx, services_list, stay_attached=False):
|
||||
global_context = ctx.parent.parent.obj
|
||||
deploy_context = ctx.obj
|
||||
if not global_context.dry_run:
|
||||
@ -73,7 +73,7 @@ def up_operation(ctx, services_list):
|
||||
print(f"Running compose up with container_exec_env: {container_exec_env}, extra_args: {services_list}")
|
||||
for pre_start_command in cluster_context.pre_start_commands:
|
||||
_run_command(global_context, cluster_context.cluster, pre_start_command)
|
||||
deploy_context.docker.compose.up(detach=True, services=services_list)
|
||||
deploy_context.docker.compose.up(detach=not stay_attached, services=services_list)
|
||||
for post_start_command in cluster_context.post_start_commands:
|
||||
_run_command(global_context, cluster_context.cluster, post_start_command)
|
||||
_orchestrate_cluster_config(global_context, cluster_context.config, deploy_context.docker, container_exec_env)
|
||||
|
@ -54,22 +54,24 @@ def make_deploy_context(ctx):
|
||||
|
||||
|
||||
@command.command()
|
||||
@click.option("--stay-attached/--detatch-terminal", default=False, help="detatch or not to see container stdout")
|
||||
@click.argument('extra_args', nargs=-1) # help: command: up <service1> <service2>
|
||||
@click.pass_context
|
||||
def up(ctx, extra_args):
|
||||
def up(ctx, stay_attached, extra_args):
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
services_list = list(extra_args) or None
|
||||
up_operation(ctx, services_list)
|
||||
up_operation(ctx, services_list, stay_attached)
|
||||
|
||||
|
||||
# start is the preferred alias for up
|
||||
@command.command()
|
||||
@click.option("--stay-attached/--detatch-terminal", default=False, help="detatch or not to see container stdout")
|
||||
@click.argument('extra_args', nargs=-1) # help: command: up <service1> <service2>
|
||||
@click.pass_context
|
||||
def start(ctx, extra_args):
|
||||
def start(ctx, stay_attached, extra_args):
|
||||
ctx.obj = make_deploy_context(ctx)
|
||||
services_list = list(extra_args) or None
|
||||
up_operation(ctx, services_list)
|
||||
up_operation(ctx, services_list, stay_attached)
|
||||
|
||||
|
||||
@command.command()
|
||||
|
Loading…
Reference in New Issue
Block a user