Skip to content

Commit 35f4f59

Browse files
authored
fix ecs_cluster integration test (#1145)
fix ecs_cluster integration test SUMMARY ecs_cluster: make ecs_cluster integration test work again - as it is bugs I've hit and must be fixed to complete this challenge ecs_taskdefinition: fix change detection of changing launch_type parameter ecs_service: compare of task_definition never works and results always in a changed task change detect of health_check_grace_period_seconds was never implemented, but tested and failing, after the task_definition is compared correctly ref: #1142 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ecs_taskdefinition ecs_service ADDITIONAL INFORMATION basically the existing test tasks are not changed. just sorted and removed what was marked as fixme because it's simple not possible (changing network settings of a created service). Reviewed-by: Alina Buzachis <None> Reviewed-by: Joseph Torcasso <None> Reviewed-by: Mark Chappell <None> Reviewed-by: Markus Bergholz <[email protected]>
1 parent 99a4adb commit 35f4f59

File tree

7 files changed

+1041
-2017
lines changed

7 files changed

+1041
-2017
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bugfixes:
2+
- ecs_taskdefinition - fix broken change detect of ``launch_type`` parameter (https://github.com/ansible-collections/community.aws/pull/1145).
3+
- ecs_service - fix broken compare of ``task_definition`` that results always in a changed task (https://github.com/ansible-collections/community.aws/pull/1145).
4+
- ecs_service - add missing change detect of ``health_check_grace_period_seconds`` parameter (https://github.com/ansible-collections/community.aws/pull/1145).

plugins/modules/ecs_service.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,14 @@ def describe_service(self, cluster_name, service_name):
549549
raise Exception("Unknown problem describing service %s." % service_name)
550550

551551
def is_matching_service(self, expected, existing):
552-
if expected['task_definition'] != existing['taskDefinition']:
552+
# aws returns the arn of the task definition
553+
# arn:aws:ecs:eu-central-1:123456789:task-definition/ansible-fargate-nginx:3
554+
# but the user is just entering
555+
# ansible-fargate-nginx:3
556+
if expected['task_definition'] != existing['taskDefinition'].split('/')[-1]:
557+
return False
558+
559+
if expected.get('health_check_grace_period_seconds') != existing.get('healthCheckGracePeriodSeconds'):
553560
return False
554561

555562
if (expected['load_balancers'] or []) != existing['loadBalancers']:

plugins/modules/ecs_taskdefinition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ def _task_definition_matches(requested_volumes, requested_containers, requested_
956956
if requested_task_role_arn != td.get('taskRoleArn', ""):
957957
return None
958958

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

962962
existing_volumes = td.get('volumes', []) or []

0 commit comments

Comments
 (0)