Fix --os-cache option on Mac OS#18
Closed
tpot wants to merge 1 commit intoopenstack:masterfrom
tpot:feature/macos-keyring-get-unicode
Closed
Fix --os-cache option on Mac OS#18tpot wants to merge 1 commit intoopenstack:masterfrom tpot:feature/macos-keyring-get-unicode
tpot wants to merge 1 commit intoopenstack:masterfrom
tpot:feature/macos-keyring-get-unicode
Conversation
|
Thank you for contributing to openstack/python-keystoneclient! openstack/python-keystoneclient uses Gerrit for code review. Please visit http://wiki.openstack.org/GerritWorkflow and follow the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The --os-cache option on Mac OS is broken and you get the following log message as it's trying to unpickle the auth_ref fetched from the keyring. The auth token and service catalog ends up being fetched every time.
The fix is to whack a str() around the result of keyring.get_password() which fixes the problem but makes me want to tear my hair out as it's the wrong way to fix it. If you dive into the OS X backend for the keyring module (https://bitbucket.org/kang/python-keyring-lib/src/598488b60d2148d4c44e64e9e725cde93a258c75/keyring/backends/OS_X.py?at=default) it does the following awful thing:
UTF-8 is not a suitable encoding for possible binary data - the keyring module assumes that a "password" is something that's a string which IMHO is why this conversion is being performed.
According to the pickle docs, "By default, the pickle data format uses a printable ASCII representation. This is slightly more voluminous than a binary representation. The big advantage of using printable ASCII (and of some other characteristics of pickle's representation) is that for debugging or recovery purposes it is possible for a human to read the pickled file with a standard text editor." I guess this means that doing a str() on the result of pickle.loads() will not cause any problems since there will be no multi-byte sequences in the string.
Having --os-cache work is pretty cool. (-: