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

[PR #2124/97131eca backport][stable-7] ecs_taskdefinition: use aws_retry to avoid throttling exception #2128

Open
wants to merge 1 commit into
base: stable-7
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions changelogs/fragments/2124-add-retry-to-ecs_taskdefinition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- ecs_taskdefinition - avoid throttling exceptions on task definitions with a large number of revisions by using the retry mechanism (https://github.com/ansible-collections/community.aws/issues/2123).
6 changes: 3 additions & 3 deletions plugins/modules/ecs_taskdefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ def fetch():
if data["nextToken"]:
params["nextToken"] = data["nextToken"]

result = self.ecs.list_task_definitions(**params)
result = self.ecs.list_task_definitions(aws_retry=True, **params)
data["taskDefinitionArns"] += result["taskDefinitionArns"]
data["nextToken"] = result.get("nextToken", None)
return data["nextToken"] is not None
Expand All @@ -929,15 +929,15 @@ def fetch():
return list(
sorted(
[
self.ecs.describe_task_definition(taskDefinition=arn)["taskDefinition"]
self.ecs.describe_task_definition(aws_retry=True, taskDefinition=arn)["taskDefinition"]
for arn in data["taskDefinitionArns"]
],
key=lambda td: td["revision"],
)
)

def deregister_task(self, taskArn):
response = self.ecs.deregister_task_definition(taskDefinition=taskArn)
response = self.ecs.deregister_task_definition(aws_retry=True, taskDefinition=taskArn)
return response["taskDefinition"]


Expand Down
Loading