From 20a548bf7711ef6c50e358fb7a039262d8d0d16e Mon Sep 17 00:00:00 2001
From: David Sariel <dsariel@redhat.com>
Date: Wed, 2 Sep 2015 14:48:17 +0300
Subject: [PATCH] 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
(cherry picked from commit 2c7da7cb6077b89a7e195f76ed092ea7dfe65e02)
---
glanceclient/v1/images.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/glanceclient/v1/images.py b/glanceclient/v1/images.py
index 11a56ba..99340d2 100644
--- a/glanceclient/v1/images.py
+++ b/glanceclient/v1/images.py
@@ -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')