Invalid output running the command 'glance image-show <image_id>'

Running the command returns the string 'id' and fails on exception.
In function _image_meta_from_headers the meta variable was not properly
set because key was not lowercased. Converting key to lowercase solves
the problem.

NOTE: this is a compatibility fix for urllib3 >= 1.11

Closes-Bug: #1487645
Co-Authored-by: Flavio Percoco <flavio@redhat.com>
Change-Id: I1b0b327163577585becb5e762536058d21dc1c98
This commit is contained in:
David Sariel 2015-09-02 14:48:17 +03:00 committed by Flavio Percoco
parent 5507d84901
commit 2c7da7cb60
1 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,11 @@ class ImageManager(base.ManagerWithFind):
meta = {'properties': {}}
safe_decode = encodeutils.safe_decode
for key, value in six.iteritems(headers):
# NOTE(flaper87): this is a compatibility fix
# for urllib3 >= 1.11. Please, refer to this
# bug for more info:
# https://bugs.launchpad.net/python-glanceclient/+bug/1487645
key = key.lower()
value = safe_decode(value, incoming='utf-8')
if key.startswith('x-image-meta-property-'):
_key = safe_decode(key[22:], incoming='utf-8')