Skip to content

Commit

Permalink
add waiter for function_update and update to v2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
jatorcasso committed May 3, 2022
1 parent 1cbbf46 commit 54ebdd4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ minor_changes:
- lambda - add kms_key_arn parameter (https://github.com/ansible-collections/community.aws/pull/1108).
bugfixes:
- lambda - fix check mode on creation (https://github.com/ansible-collections/community.aws/pull/1108).
- execute_lamba - add waiter for function_update and update waiters to v2 (https://github.com/ansible-collections/community.aws/pull/1108).
6 changes: 4 additions & 2 deletions plugins/modules/execute_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,10 @@ def main():

def wait_for_lambda(client, module, name):
try:
waiter = client.get_waiter('function_active')
waiter.wait(FunctionName=name)
client_active_waiter = client.get_waiter('function_active_v2')
client_updated_waiter = client.get_waiter('function_updated_v2')
client_active_waiter.wait(FunctionName=name)
client_updated_waiter.wait(FunctionName=name)
except botocore.exceptions.WaiterError as e:
module.fail_json_aws(e, msg='Timeout while waiting on lambda to be Active')
except (botocore.exceptions.ClientError, botocore.exceptions.BotoCoreError) as e:
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ def set_tag(client, module, tags, function):

def wait_for_lambda(client, module, name):
try:
client_active_waiter = client.get_waiter('function_active')
client_updated_waiter = client.get_waiter('function_updated')
client_active_waiter = client.get_waiter('function_active_v2')
client_updated_waiter = client.get_waiter('function_updated_v2')
client_active_waiter.wait(FunctionName=name)
client_updated_waiter.wait(FunctionName=name)
except WaiterError as e:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/targets/lambda/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@
that:
- result is not failed
- result.changed == True
- result.environment.variables.extra_message == "I think you are great!!"

- name: test lambda works
execute_lambda:
name: '{{lambda_function_name}}'
Expand Down

0 comments on commit 54ebdd4

Please sign in to comment.