From 94519d51459a171cb2948271863899f2b29603a6 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Sat, 28 Sep 2019 11:49:45 +0200 Subject: [PATCH] Internal refactor for reduce number of arguments --- ecs_deploy/cli.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ecs_deploy/cli.py b/ecs_deploy/cli.py index 976f114..6538ca9 100644 --- a/ecs_deploy/cli.py +++ b/ecs_deploy/cli.py @@ -101,8 +101,7 @@ def deploy(cluster, service, tag, image, command, env, secret, role, execution_r success_message='Deployment successful', failure_message='Deployment failed', timeout=timeout, - deregister=deregister, - previous_task_definition=td, + task_definition_to_deregister=deregister and td, ignore_warnings=ignore_warnings, sleep_time=sleep_time ) @@ -432,9 +431,8 @@ def wait_for_finish(action, timeout, title, success_message, failure_message, click.secho('\n%s\n' % success_message, fg='green') -def deploy_task_definition(deployment, task_definition, title, success_message, - failure_message, timeout, deregister, - previous_task_definition, ignore_warnings, sleep_time): +def deploy_task_definition(deployment, task_definition, title, success_message, failure_message, timeout, + ignore_warnings, sleep_time, task_definition_to_deregister=None): click.secho('Updating service') deployment.deploy(task_definition) @@ -455,8 +453,8 @@ def deploy_task_definition(deployment, task_definition, title, success_message, sleep_time=sleep_time ) - if deregister: - deregister_task_definition(deployment, previous_task_definition) + if task_definition_to_deregister: + deregister_task_definition(deployment, task_definition_to_deregister) def get_task_definition(action, task): @@ -500,8 +498,7 @@ def rollback_task_definition(deployment, old, new, timeout=600, sleep_time=1): success_message='Rollback successful', failure_message='Rollback failed. Please check ECS Console', timeout=timeout, - deregister=True, - previous_task_definition=new, + task_definition_to_deregister=new, ignore_warnings=False, sleep_time=sleep_time )