Base64 output cannot be JSON encoded in py3
Bug #1323450 reported by
Jamie Lennox
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-novaclient |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The output of base64.b64encode in python 3 is bytes: https:/
jsonutils.dumps (or any json method) cannot convert bytes into JSON representable text.
Therefore anywhere in novaclient that does a base64.encode and sends that through as data to be sent to a request will fail under python 3 (will succeed in python2).
Unfortunately unit tests don't catch this because the fakeclient intercepts the request before it is sent to the json dumps component.
summary: |
- Bae64 output cannot be JSON encoded in py3 + Base64 output cannot be JSON encoded in py3 |
Changed in python-novaclient: | |
milestone: | none → 2.18.0 |
Changed in python-novaclient: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Reviewed: https:/ /review. openstack. org/95623 /git.openstack. org/cgit/ openstack/ python- novaclient/ commit/ ?id=ecebc308b33 94d4847cf32b37f 93fd08c646a39d
Committed: https:/
Submitter: Jenkins
Branch: master
commit ecebc308b3394d4 847cf32b37f93fd 08c646a39d
Author: Jamie Lennox <email address hidden>
Date: Tue May 27 10:30:47 2014 +1000
In Py3 decode the output of base64.decode
The return from a base64.encode in python 3 is bytes. Bytes cannot be
json.dumps() so when we base64 encode some data we need to convert it
to a string before passing it through to the request layer.
This isn't shown by unit tests because the fakeclient mocking layer
intercepts the request before it gets to the json encoding code.
Closes-Bug: #1323450 9178e3bf0ee9998 b806bc629ff
Change-Id: Ibbbb24f64c1706