-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lambda - Remove non-UTF-8 data from module output #2386
lambda - Remove non-UTF-8 data from module output #2386
Conversation
5156a21
to
598a2d1
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 59s |
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ZipFile
is added here. Ideally, we should remove the function that updates this value in the return dictionary. However, could we instead encode it with UTF-8 rather than removing it? Removing it might impact existing usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't encode it as UTF-8 because it's binary data, not text. If we want to continue returning it we need to base64 encode it. However, I'm not sure what the value is in outputing the binary contents of the zipfile, and from what I can see, it's not a documented return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, @gravesm. If we decide to remove the ZipFile field from the return dictionary, would it be okay also to remove the function and its corresponding call? cc @ichekaldin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the binary contents are used in the boto call to update the function:
amazon.aws/plugins/modules/lambda.py
Line 799 in 598a2d1
response = client.update_function_code(aws_retry=True, **code_kwargs) |
I think what's done in this PR is the right way to handle it. I would consider this a bugfix, not a breaking change, because there's virtually no way this data has ever been usable. For ansible to output this it will have had to drop bytes it can't decode, so what's output has probably never been the actual contents of the zipfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that line. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@GomathiselviS Does this PR need to be backported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It can be. I will add the label.
Build succeeded (gate pipeline). ✔️ ansible-galaxy-importer SUCCESS in 5m 08s |
a39b3e0
into
ansible-collections:main
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
Backport to stable-9: cherry-pick succeededBackport PR branch: PR branch created, proceeding with making a PR. 🤖 @patchback |
Backport to stable-8: 💚 backport PR created✅ Backport PR branch: Backported as #2392 🤖 @patchback |
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: GomathiselviS <[email protected]> Reviewed-by: Mike Graves <[email protected]> (cherry picked from commit 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: GomathiselviS <[email protected]> Reviewed-by: Mike Graves <[email protected]> (cherry picked from commit a39b3e0)
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
Backport to stable-9: 💚 backport PR created✅ Backport PR branch: Backported as #2442 🤖 @patchback |
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: GomathiselviS <[email protected]> Reviewed-by: Mike Graves <[email protected]> (cherry picked from commit a39b3e0)
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: Helen Bailey <[email protected]> Reviewed-by: Mandar Kulkarni <[email protected]>
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
COMPONENT NAME
lambda
ADDITIONAL INFORMATION