Skip to content
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

Conversation

ichekaldin
Copy link
Contributor

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

@ichekaldin ichekaldin force-pushed the lambda-remove-non-utf-8-output branch from 5156a21 to 598a2d1 Compare November 8, 2024 16:57
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/91e79d5efe20401898dc3dacba6b59c7

✔️ ansible-galaxy-importer SUCCESS in 4m 59s
✔️ build-ansible-collection SUCCESS in 10m 02s
✔️ ansible-test-splitter SUCCESS in 3m 50s
✔️ integration-amazon.aws-1 SUCCESS in 9m 10s
Skipped 43 jobs

@@ -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)
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

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

Copy link
Member

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:

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.

Copy link
Contributor

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!

Copy link
Collaborator

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?

Copy link
Contributor

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.

@GomathiselviS GomathiselviS added the mergeit Merge the PR (SoftwareFactory) label Nov 15, 2024
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/0927e0f665184391a70a4fb025229bb7

✔️ ansible-galaxy-importer SUCCESS in 5m 08s
✔️ build-ansible-collection SUCCESS in 10m 09s
✔️ ansible-test-splitter SUCCESS in 4m 01s
✔️ integration-amazon.aws-1 SUCCESS in 10m 25s
Skipped 43 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit a39b3e0 into ansible-collections:main Nov 15, 2024
45 checks passed
Copy link

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

@GomathiselviS GomathiselviS added backport-8 PR should be backported to the stable-8 branch backport-9 labels Nov 18, 2024
Copy link

patchback bot commented Nov 18, 2024

Backport to stable-9: cherry-pick succeeded

Backport PR branch: patchback/backports/stable-9/a39b3e007156801368129567820203fec2e1b72f/pr-2386

PR branch created, proceeding with making a PR.

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Copy link

patchback bot commented Nov 18, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/a39b3e007156801368129567820203fec2e1b72f/pr-2386

Backported as #2392

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Nov 18, 2024
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)
patchback bot pushed a commit that referenced this pull request Nov 18, 2024
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)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Nov 18, 2024
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
@ichekaldin ichekaldin deleted the lambda-remove-non-utf-8-output branch November 25, 2024 17:34
Copy link

patchback bot commented Jan 8, 2025

Backport to stable-9: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-9/a39b3e007156801368129567820203fec2e1b72f/pr-2386

Backported as #2442

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 8, 2025
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)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Jan 9, 2025
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 PR should be backported to the stable-8 branch backport-9 mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lambda can return invalid binary data
5 participants