Skip to content

Commit

Permalink
Remove non-UTF-8 data from module output (#2386) (#2392)
Browse files Browse the repository at this point in the history
This is a backport of PR #2386 as merged into main (a39b3e0).
SUMMARY


Fixes #2307.
Ansible previously generated warning is module output contained non UTF-8 data. Starting with version 2.18, it now throws an error, which prevents successful execution of lambda module.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

lambda
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
  • Loading branch information
patchback[bot] authored Nov 18, 2024
1 parent ff56064 commit 51f7a8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/2386-lambda-remove-non-utf-8-output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- lambda - Remove non UTF-8 data (contents of Lambda ZIP file) from the module output to avoid Ansible error (https://github.com/ansible-collections/amazon.aws/issues/2386).
3 changes: 3 additions & 0 deletions plugins/modules/lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,9 @@ def main():
module.fail_json(msg="Unable to get function information after updating")
response = format_response(response)
# We're done
# "ZipFile" attribute contains non UTF-8 data. Ansible considers it an error
# starting with version 2.18. Removing it from the output avoids the error.
code_kwargs.pop("ZipFile", None)
module.exit_json(changed=changed, code_kwargs=code_kwargs, func_kwargs=func_kwargs, **response)

# Function doesn't exist, create new Lambda function
Expand Down

0 comments on commit 51f7a8e

Please sign in to comment.