Skip to content

Commit

Permalink
Minor fixups
Browse files Browse the repository at this point in the history
- bad rebase resulted in a duplicated parameter
- Fixup "changed" after adding initial support for tags
  • Loading branch information
tremble committed Jul 8, 2022
1 parent 46cc4fe commit b71c1b0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
7 changes: 3 additions & 4 deletions plugins/modules/ecs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ def is_matching_service(self, expected, existing):
# but the user is just entering
# ansible-fargate-nginx:3
if expected['task_definition'] != existing['taskDefinition'].split('/')[-1]:
if existing['deploymentController']['type'] != 'CODE_DEPLOY':
if existing.get('deploymentController', {}).get('type', None) != 'CODE_DEPLOY':
return False

if expected.get('health_check_grace_period_seconds'):
Expand All @@ -748,10 +748,10 @@ def is_matching_service(self, expected, existing):
if (expected['load_balancers'] or []) != existing['loadBalancers']:
return False

if expected['propagate_tags'] != existing['propagateTags']:
if (expected['propagate_tags'] or "NONE") != existing['propagateTags']:
return False

if boto3_tag_list_to_ansible_dict(existing['tags']) != expected['tags']:
if boto3_tag_list_to_ansible_dict(existing.get('tags', [])) != (expected['tags'] or {}):
return False

# expected is params. DAEMON scheduling strategy returns desired count equal to
Expand Down Expand Up @@ -1068,7 +1068,6 @@ def main():
network_configuration,
serviceRegistries,
module.params['launch_type'],
module.params['scheduling_strategy'],
module.params['platform_version'],
module.params['scheduling_strategy'],
capacityProviders,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# - tests/unit/constraints.txt
# - tests/integration/constraints.txt
# - tests/integration/targets/setup_botocore_pip
botocore>=1.20.0
boto3>=1.17.0
botocore>=1.21.0
boto3>=1.18.0
6 changes: 3 additions & 3 deletions tests/integration/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Specifically run tests against the oldest versions that we support
boto3==1.17.0
botocore==1.20.0
boto3==1.18.0
botocore==1.21.0

# AWS CLI has `botocore==` dependencies, provide the one that matches botocore
# to avoid needing to download over a years worth of awscli wheels.
awscli==1.19.0
awscli==1.20.0
29 changes: 28 additions & 1 deletion tests/integration/targets/ecs_cluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
assert:
that:
- "ecs_service.service.placementConstraints[0].type == 'distinctInstance'"

- name: check that ECS service was created with deployment_circuit_breaker
assert:
that:
Expand Down Expand Up @@ -264,6 +264,32 @@
assert:
that:
- not ecs_service_again.changed
ignore_errors: True

- name: Enable ExecuteCommand
ecs_service:
state: present
name: "{{ ecs_service_name }}"
cluster: "{{ ecs_cluster_name }}"
task_definition: "{{ ecs_task_name }}:{{ ecs_task_definition.taskdefinition.revision }}"
desired_count: 1
deployment_configuration: "{{ ecs_service_deployment_configuration }}"
placement_strategy: "{{ ecs_service_placement_strategy }}"
placement_constraints:
- type: distinctInstance
health_check_grace_period_seconds: "{{ ecs_service_health_check_grace_period }}"
load_balancers:
- targetGroupArn: "{{ elb_target_group_instance.target_group_arn }}"
containerName: "{{ ecs_task_name }}"
containerPort: "{{ ecs_task_container_port }}"
role: "ecsServiceRole"
enable_execute_command: True
register: ecs_service_again

- name: check that ECS service recreation changed nothing
assert:
that:
- ecs_service_again.changed

- name: create same ECS service definition via force_new_deployment
ecs_service:
Expand Down Expand Up @@ -329,6 +355,7 @@
containerName: "{{ ecs_task_name }}"
containerPort: "{{ ecs_task_container_port }}"
role: "ecsServiceRole"
wait: true
register: ecs_service_scale_down

- name: assert that ECS service is scaled down
Expand Down

0 comments on commit b71c1b0

Please sign in to comment.