Skip to content

Commit

Permalink
Internal refactor for reduce number of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Sep 28, 2019
1 parent 7eb692e commit 94519d5
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions ecs_deploy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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)

Expand All @@ -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):
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit 94519d5

Please sign in to comment.