Skip to content
This repository was archived by the owner on Mar 15, 2026. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Should address issue #38. The calls to determine whether or not a fun…
…ction exists wasn't calling multiple times if you have more than 50 lambda functions configured. For those users who have lots of functions defined, the deploy will try to re-create an existing lambda function
  • Loading branch information
asaolabs committed Sep 16, 2017
commit 06f9e8406a5629854f8ecc5d77a7aaf4895cdb0a
15 changes: 10 additions & 5 deletions aws_lambda/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,13 @@ def function_exists(cfg, function_name):
'lambda', aws_access_key_id, aws_secret_access_key,
cfg.get('region'),
)
functions = client.list_functions().get('Functions', [])
for fn in functions:
if fn.get('FunctionName') == function_name:
return True
return False

# Need to loop through until we get all of the lambda functions returned. It appears
# to be only returning 50 functions at a time.
functions = []
functions_resp = client.list_functions()
functions.extend([f['FunctionName'] for f in functions_resp.get('Functions', [])])
while('NextMarker' in functions_resp):
functions_resp = client.list_functions(Marker=functions_resp.get('NextMarker'))
functions.extend([f['FunctionName'] for f in functions_resp.get('Functions', [])])
return function_name in functions