-
Notifications
You must be signed in to change notification settings - Fork 66
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
Encode output.print_error message to avoid UnicodeEncodeError when displaying errors #806
Conversation
Thank you for contributing to the Leapp project!Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergable.
To launch regression testing public members of oamg organization can leave the following comment:
Please open ticket in case you experience technical problem with the CI. (RH internal only) Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please consider rerunning the CI by commenting leapp-ci build (might require several comments). If the problem persists, contact leapp-infra. |
This PR has been linked in issue tracker (OAMG-8043). |
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.
Code looks ok, but I am really missing a unit test that covers this particular case. Could you please add one?
@prilr Added a really naive unit test, checked it failed on py2.7 if applied on master. If you are ok with the changes, please squash previous 5 commits into one and let's merge it :) |
/rerun |
Copr build succeeded: https://copr.fedorainfracloud.org/coprs/build/5309507 |
Testing Farm request for RHEL-8.6-rhui/5290656;5309507 regression testing has been created. |
Testing Farm request for RHEL-7.9-rhui/5290656;5309507 regression testing has been created. |
Testing Farm request for RHEL-8.6.0-Nightly/5290656;5309507 regression testing has been created. |
Testing Farm request for RHEL-8.7.0-Nightly/5290656;5309507 regression testing has been created. |
Testing Farm request for RHEL-7.9-ZStream/5290656;5309507 regression testing has been created. |
Testing Farm request for RHEL-7.9-ZStream/5290656;5309507 regression testing has been created. |
Add a test that fails without a patch for python2.7 but passes with the patch applied.
6ffc941
to
cb691cb
Compare
So I went on and squashed the commits :) Thanks for the contribution! |
## Packaging - Change permissions for /var/lib/leapp to 0700 (oamg#807) ## Framework ### Fixes - Prevent unicode errors when printing error messages (oamg#806) - Make checks for missing answers more strict (oamg#797) ### Enhancements - Expose tracebacks from actors (oamg#802) ### Known issue - introduced new known issue in framework...
When leapp executes in a Python 2 environment, an actor encountering an error can cause further issues if the message string provided to
leapp.utils.output
contains non-ASCII characters.This line in output.py is the main problem:
As you can see, this line isn't Unicode in Python 2, which is why trying to format it with u-strings directly will end up causing an error like the one below:
This results in the actor error itself not being displayed, only the subsequent UnicodeEncodeError exception.
I'm not sure the way I went about correcting the problem in this PR is the optimal one.
If there's a different solution you'd rather see, please let me know.