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

Pagination for describe_launch_template_versions #2133

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

matiaskorhonen
Copy link

@matiaskorhonen matiaskorhonen commented Aug 1, 2024

SUMMARY

Fixes #2131

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

ec2_launch_template

ADDITIONAL INFORMATION

Uses the same logic for pagination as:

def describe_task_definitions(self, family):
data = {"taskDefinitionArns": [], "nextToken": None}
def fetch():
# Boto3 is weird about params passed, so only pass nextToken if we have a value
params = {"familyPrefix": family}
if data["nextToken"]:
params["nextToken"] = data["nextToken"]
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
# Fetch all the arns, possibly across multiple pages
while fetch():
pass

@matiaskorhonen matiaskorhonen marked this pull request as ready for review August 1, 2024 12:07
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/16ad7fce72874c50ad3247c6e3f88b0c

ansible-galaxy-importer FAILURE in 4m 39s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 49s
✔️ ansible-test-splitter SUCCESS in 4m 20s
✔️ integration-community.aws-1 SUCCESS in 5m 40s
Skipped 21 jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a new launch template version can fail if there are over 200 existing versions
1 participant