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

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

@abikouo
Copy link
Contributor

abikouo commented Oct 3, 2024

Closing this as this will be addressed with the refactoring by PRs
#2164 and ansible-collections/amazon.aws#2319

@abikouo abikouo closed this Oct 3, 2024
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
2 participants