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

ecs_* - fix idempotence bug in ecs_service and dont require cluster #1212

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bugfixes:
- ecs_service - fix broken change detect of ``health_check_grace_period_seconds`` parameter when not specified (https://github.com/ansible-collections/community.aws/pull/1212).
- ecs_service - use default cluster name of ``default`` when not input (https://github.com/ansible-collections/community.aws/pull/1212).
- ecs_task - dont require ``cluster`` and use name of ``default`` when not input (https://github.com/ansible-collections/community.aws/pull/1212).
9 changes: 6 additions & 3 deletions plugins/modules/ecs_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
cluster:
description:
- The name of the cluster in which the service exists.
- If not specified, the cluster name will be C(default).
required: false
type: str
default: 'default'
task_definition:
description:
- The task definition the service will run.
Expand Down Expand Up @@ -608,8 +610,9 @@ def is_matching_service(self, expected, existing):
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.get('health_check_grace_period_seconds'):
if expected.get('health_check_grace_period_seconds') != existing.get('healthCheckGracePeriodSeconds'):
return False

if (expected['load_balancers'] or []) != existing['loadBalancers']:
return False
Expand Down Expand Up @@ -717,7 +720,7 @@ def main():
argument_spec = dict(
state=dict(required=True, choices=['present', 'absent', 'deleting']),
name=dict(required=True, type='str', aliases=['service']),
cluster=dict(required=False, type='str'),
cluster=dict(required=False, type='str', default='default'),
task_definition=dict(required=False, type='str'),
load_balancers=dict(required=False, default=[], type='list', elements='dict'),
desired_count=dict(required=False, type='int'),
Expand Down
6 changes: 4 additions & 2 deletions plugins/modules/ecs_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
cluster:
description:
- The name of the cluster to run the task on.
required: True
- If not specified, the cluster name will be C(default).
required: False
type: str
default: 'default'
task_definition:
description:
- The task definition to start, run or stop.
Expand Down Expand Up @@ -342,7 +344,7 @@ def ecs_task_long_format_enabled(self):
def main():
argument_spec = dict(
operation=dict(required=True, choices=['run', 'start', 'stop']),
cluster=dict(required=True, type='str'), # R S P
cluster=dict(required=False, type='str', default='default'), # R S P
task_definition=dict(required=False, type='str'), # R* S*
overrides=dict(required=False, type='dict'), # R S
count=dict(required=False, type='int'), # R
Expand Down