Skip to content

Commit 777ef58

Browse files
committed
[NDR-192] Paginate
1 parent 3a02d6e commit 777ef58

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/bulk-upload/scripts/run_bulk_upload.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import json
3+
import logging
34
import sys
45

56
import boto3
@@ -22,6 +23,7 @@ def update_lambda_environment_variables(lambda_name, new_variable):
2223
response = lambda_client.get_function_configuration(FunctionName=lambda_name)
2324
current_environment = response["Environment"]["Variables"]
2425
if current_environment.get("PDS_FHIR_IS_STUBBED"):
26+
logging.info("Var exists for" + lambda_name)
2527
updated_environment = current_environment.copy()
2628
updated_environment.update(new_variable)
2729

@@ -55,12 +57,18 @@ def update_lambda_environment_variables(lambda_name, new_variable):
5557

5658
client = boto3.client("lambda")
5759

58-
response = client.list_functions()
60+
paginator = client.get_paginator("list_functions")
61+
62+
response_iterator = paginator.paginate()
63+
64+
all_functions = []
65+
for page in response_iterator:
66+
all_functions.extend(page["Functions"])
5967

6068
lambda_to_update = [
6169
func["FunctionName"]
62-
for func in response["Functions"]
63-
if func["FunctionName"].startswith(f"{args.environment}_")
70+
for func in all_functions
71+
if func["FunctionName"].startswith(f"{args.environment}")
6472
]
6573

6674
if args.disable_pds_stub or (

0 commit comments

Comments
 (0)