Don't hack the image url

It's actually breaking usage against HP Public Cloud.

Change-Id: Ic172786c6d1272798b768078a0bcf246f8d64ca8
This commit is contained in:
Monty Taylor 2015-03-03 10:45:29 -05:00 committed by Dean Troyer
parent 5b8f18fe4b
commit 59727ba2f9
2 changed files with 12 additions and 4 deletions

View File

@ -19,11 +19,18 @@ from openstackclient.api import api
class APIv1(api.BaseAPI): class APIv1(api.BaseAPI):
"""Image v1 API""" """Image v1 API"""
_endpoint_suffix = 'v1'
def __init__(self, endpoint=None, **kwargs): def __init__(self, endpoint=None, **kwargs):
super(APIv1, self).__init__(endpoint=endpoint, **kwargs) super(APIv1, self).__init__(endpoint=endpoint, **kwargs)
self.endpoint = self.endpoint.rstrip('/')
self._munge_url()
def _munge_url(self):
# Hack this until discovery is up # Hack this until discovery is up
self.endpoint = '/'.join([self.endpoint.rstrip('/'), 'v1']) if self._endpoint_suffix not in self.endpoint.split('/')[-1]:
self.endpoint = '/'.join([self.endpoint, self._endpoint_suffix])
def image_list( def image_list(
self, self,

View File

@ -19,11 +19,12 @@ from openstackclient.api import image_v1
class APIv2(image_v1.APIv1): class APIv2(image_v1.APIv1):
"""Image v2 API""" """Image v2 API"""
def __init__(self, endpoint=None, **kwargs): _endpoint_suffix = 'v2'
super(APIv2, self).__init__(endpoint=endpoint, **kwargs)
def _munge_url(self):
# Hack this until discovery is up, and ignore parent endpoint setting # Hack this until discovery is up, and ignore parent endpoint setting
self.endpoint = '/'.join([endpoint.rstrip('/'), 'v2']) if 'v2' not in self.endpoint.split('/')[-1]:
self.endpoint = '/'.join([self.endpoint, 'v2'])
def image_list( def image_list(
self, self,