Merge "URLs to glance need to be absolute."
This commit is contained in:
commit
da8e3677f6
@ -89,7 +89,7 @@ class ImageService(object):
|
||||
if self.auth_token:
|
||||
headers.setdefault('x-auth-token', self.auth_token)
|
||||
|
||||
logging.debug(_('Request: %(method)s http://%(server)s:%(port)s/'
|
||||
logging.debug(_('Request: %(method)s http://%(server)s:%(port)s'
|
||||
'%(url)s with headers %(headers)s')
|
||||
% {'method': method,
|
||||
'server': self.conn.host,
|
||||
@ -129,7 +129,7 @@ class ImageService(object):
|
||||
params = {'is_public': None}
|
||||
|
||||
while True:
|
||||
url = 'v1/images/detail'
|
||||
url = '/v1/images/detail'
|
||||
query = urllib.urlencode(params)
|
||||
if query:
|
||||
url += '?%s' % query
|
||||
@ -150,7 +150,7 @@ class ImageService(object):
|
||||
|
||||
Returns: a httplib Response object where the body is the image.
|
||||
"""
|
||||
url = 'v1/images/%s' % image_uuid
|
||||
url = '/v1/images/%s' % image_uuid
|
||||
return self._http_request('GET', url, {}, '')
|
||||
|
||||
@staticmethod
|
||||
@ -178,7 +178,7 @@ class ImageService(object):
|
||||
|
||||
Returns: image metadata as a dictionary
|
||||
"""
|
||||
url = 'v1/images/%s' % image_uuid
|
||||
url = '/v1/images/%s' % image_uuid
|
||||
response = self._http_request('HEAD', url, {}, '',
|
||||
ignore_result_body=True)
|
||||
return self._header_list_to_dict(response.getheaders())
|
||||
@ -210,7 +210,7 @@ class ImageService(object):
|
||||
Returns: a tuple of (http response headers, http response body)
|
||||
"""
|
||||
|
||||
url = 'v1/images'
|
||||
url = '/v1/images'
|
||||
headers = self._dict_to_headers(image_meta)
|
||||
headers['Content-Type'] = 'application/octet-stream'
|
||||
headers['Content-Length'] = int(image_meta['size'])
|
||||
@ -230,7 +230,7 @@ class ImageService(object):
|
||||
Returns: a tuple of (http response headers, http response body)
|
||||
"""
|
||||
|
||||
url = 'v1/images/%s' % image_meta['id']
|
||||
url = '/v1/images/%s' % image_meta['id']
|
||||
headers = self._dict_to_headers(image_meta)
|
||||
headers['Content-Type'] = 'application/octet-stream'
|
||||
|
||||
|
@ -85,6 +85,9 @@ class FakeHTTPConnection(object):
|
||||
|
||||
def prime_request(self, method, url, in_body, in_headers,
|
||||
out_body, out_headers):
|
||||
if not url.startswith('/'):
|
||||
url = '/' + url
|
||||
|
||||
hkeys = in_headers.keys()
|
||||
hkeys.sort()
|
||||
hashable = (method, url, in_body, ' '.join(hkeys))
|
||||
|
Loading…
Reference in New Issue
Block a user