def delete(ctx, service_name, dry_run):
"""
Delete the service SERVICE_NAME from AWS.
"""
service = Service(yml=Config(filename=ctx.obj['CONFIG_FILE'], env_file=ctx.obj['ENV_FILE']).get_service(service_name))
print()
click.secho('Deleting service "{}":'.format(service.serviceName), fg="white")
click.secho(' Service info:', fg="green")
print_service_info(service)
click.secho(' Task Definition info:', fg="green")
print_task_definition(service.active_task_definition)
print()
if not dry_run:
click.echo("If you really want to do this, answer \"{}\" to the question below.\n".format(service.serviceName))
value = click.prompt("What service do you want to delete? ")
if value == service.serviceName:
service.scale(0)
print(" Waiting for our existing containers to die ...")
service.wait_until_stable()
print(" All containers dead.")
service.delete()
print(" Deleted service {} from cluster {}.".format(service.serviceName, service.clusterName))
else:
click.echo("\nNot deleting service \"{}\"".format(service.serviceName))
评论列表
文章目录