Skip to content

Commit

Permalink
backport-4: Minor fixups (#1328) (#1393)
Browse files Browse the repository at this point in the history
backport-4: Minor fixups (#1328)

forgotten backport-4 breaks ecs_service  in 4.1.0
after it's merged, 4.1.1 must be released asap
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1659604767.311191-146-86085088410654/AnsiballZ_ecs_service.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1659604767.311191-146-86085088410654/AnsiballZ_ecs_service.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1659604767.311191-146-86085088410654/AnsiballZ_ecs_service.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.ecs_service', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_ecs_service_payload_jubeafm6/ansible_ecs_service_payload.zip/ansible_collections/community/aws/plugins/modules/ecs_service.py", line 1134, in <module>
  File "/tmp/ansible_ecs_service_payload_jubeafm6/ansible_ecs_service_payload.zip/ansible_collections/community/aws/plugins/modules/ecs_service.py", line 969, in main
  File "/tmp/ansible_ecs_service_payload_jubeafm6/ansible_ecs_service_payload.zip/ansible_collections/community/aws/plugins/modules/ecs_service.py", line 733, in is_matching_service
KeyError: 'deploymentController'

ecs_service - Minor fixups
SUMMARY
Bad rebase resulted in a duplicated parameter
Fixup "changed" after adding initial support for tags
ISSUE TYPE
Feature Pull Request
COMPONENT NAME
ecs_service
ADDITIONAL INFORMATION
Bugs aren't in a released version yet, no need for changelog
Reviewed-by: Joseph Torcasso 
SUMMARY


ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
  • Loading branch information
markuman authored Aug 4, 2022
1 parent c7720d7 commit b772c39
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/1393-ecs_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- ecs_service - fixes KeyError for ``deployment_controller`` parameter (https://github.com/ansible-collections/community.aws/pull/1393).
7 changes: 3 additions & 4 deletions plugins/modules/ecs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,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 @@ -740,10 +740,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 @@ -1049,7 +1049,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
3 changes: 2 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 @@ -329,6 +329,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 b772c39

Please sign in to comment.