Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ecs_cluster integration test #1145

Merged
merged 21 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fragments/0000-ecs_taskdefinition_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bugfixes:
- ecs_taskdefinition - fix broken change detect of ``launch_type`` parameter (https://github.com/ansible-collections/community.aws/pull/1145).
- ecs_service - fix broken compare of ``task_definition`` that results always in a changed task (https://github.com/ansible-collections/community.aws/pull/1145).
- ecs_service - add missing change detect of ``health_check_grace_period_seconds`` parameter (https://github.com/ansible-collections/community.aws/pull/1145).
9 changes: 8 additions & 1 deletion plugins/modules/ecs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,14 @@ def describe_service(self, cluster_name, service_name):
raise Exception("Unknown problem describing service %s." % service_name)

def is_matching_service(self, expected, existing):
if expected['task_definition'] != existing['taskDefinition']:
# aws returns the arn of the task definition
# arn:aws:ecs:eu-central-1:123456789:task-definition/ansible-fargate-nginx:3
# but the user is just entering
# ansible-fargate-nginx:3
if expected['task_definition'] != existing['taskDefinition'].split('/')[-1]:
return False

if expected.get('health_check_grace_period_seconds') != existing.get('healthCheckGracePeriodSeconds'):
return False

if (expected['load_balancers'] or []) != existing['loadBalancers']:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/ecs_taskdefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def _task_definition_matches(requested_volumes, requested_containers, requested_
if requested_task_role_arn != td.get('taskRoleArn', ""):
return None

if requested_launch_type is not None and requested_launch_type not in td.get('compatibilities', []):
if requested_launch_type is not None and requested_launch_type not in td.get('requiresCompatibilities', []):
return None

existing_volumes = td.get('volumes', []) or []
Expand Down
Loading