Base64 output cannot be JSON encoded in py3

Bug #1323450 reported by Jamie Lennox
6
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://docs.python.org/3/library/base64.html#base64.b64encode
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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/95623
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=ecebc308b3394d4847cf32b37f93fd08c646a39d
Submitter: Jenkins
Branch: master

commit ecebc308b3394d4847cf32b37f93fd08c646a39d
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
    Change-Id: Ibbbb24f64c17069178e3bf0ee9998b806bc629ff

Changed in python-novaclient:
status: New → Fix Committed
Michael Still (mikal)
Changed in python-novaclient:
milestone: none → 2.18.0
Michael Still (mikal)
Changed in python-novaclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.