Skip to content

Commit

Permalink
Fix error when there is no next-token (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansb authored Aug 27, 2024
1 parent eb07c74 commit d1b6465
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions efopen/ef_aws_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,12 @@ def acm_certificate_arn(self, lookup, default=None):
# This a region-specific client, so we'll make a new client in the right place using existing SESSION
region_name, domain_name = lookup.split("/")
acm_client = EFAwsResolver.__CLIENTS["SESSION"].client(service_name="acm", region_name=region_name)
next_token = None
kwargs = dict(CertificateStatuses=['ISSUED'], MaxItems=100)
while True:
response = acm_client.list_certificates(
CertificateStatuses=['ISSUED'],
MaxItems=100,
NextToken=next_token
)
response = acm_client.list_certificates(**kwargs)
cert_summaries.extend(response["CertificateSummaryList"])
if response.get("NextToken"):
next_token = response["NextToken"]
kwargs["NextToken"] = response["NextToken"]
else:
break
except Exception:
Expand Down

0 comments on commit d1b6465

Please sign in to comment.