Quote image ids before passing them to glance
If the image id contains a space it needs to be quoted or else it will construct an improper header. Fixes bug 1111948 Change-Id: I4db2e74401b57de9666d40b38151182b2a76cd1b
This commit is contained in:
@@ -91,13 +91,16 @@ class ImageManager(base.Manager):
|
||||
pass
|
||||
return meta
|
||||
|
||||
def get(self, image_id):
|
||||
def get(self, image):
|
||||
"""Get the metadata for a specific image.
|
||||
|
||||
:param image: image object or id to look up
|
||||
:rtype: :class:`Image`
|
||||
"""
|
||||
resp, body = self.api.raw_request('HEAD', '/v1/images/%s' % image_id)
|
||||
|
||||
image_id = base.getid(image)
|
||||
resp, body = self.api.raw_request('HEAD', '/v1/images/%s'
|
||||
% urllib.quote(image_id))
|
||||
meta = self._image_meta_from_headers(dict(resp.getheaders()))
|
||||
return Image(self, meta)
|
||||
|
||||
@@ -109,7 +112,8 @@ class ImageManager(base.Manager):
|
||||
:rtype: iterable containing image data
|
||||
"""
|
||||
image_id = base.getid(image)
|
||||
resp, body = self.api.raw_request('GET', '/v1/images/%s' % image_id)
|
||||
resp, body = self.api.raw_request('GET', '/v1/images/%s'
|
||||
% urllib.quote(image_id))
|
||||
checksum = resp.getheader('x-image-meta-checksum', None)
|
||||
if do_checksum and checksum is not None:
|
||||
return utils.integrity_iter(body, checksum)
|
||||
|
Reference in New Issue
Block a user