diff options
| author | Monty Taylor <mordred@inaugust.com> | 2015-03-03 10:45:29 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2015-03-05 20:58:23 -0600 |
| commit | 59727ba2f9bea133a1a7cf6ebe772d442568f312 (patch) | |
| tree | 1cf6876bba43062329026416ae1a4c7e21d233c8 /openstackclient/api | |
| parent | 5b8f18fe4b15069b024e3b84717551fb4c769745 (diff) | |
| download | python-openstackclient-59727ba2f9bea133a1a7cf6ebe772d442568f312.tar.gz | |
Don't hack the image url
It's actually breaking usage against HP Public Cloud.
Change-Id: Ic172786c6d1272798b768078a0bcf246f8d64ca8
Diffstat (limited to 'openstackclient/api')
| -rw-r--r-- | openstackclient/api/image_v1.py | 9 | ||||
| -rw-r--r-- | openstackclient/api/image_v2.py | 7 |
2 files changed, 12 insertions, 4 deletions
diff --git a/openstackclient/api/image_v1.py b/openstackclient/api/image_v1.py index c363ce49..534c7750 100644 --- a/openstackclient/api/image_v1.py +++ b/openstackclient/api/image_v1.py @@ -19,11 +19,18 @@ from openstackclient.api import api class APIv1(api.BaseAPI): """Image v1 API""" + _endpoint_suffix = 'v1' + def __init__(self, endpoint=None, **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 - 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( self, diff --git a/openstackclient/api/image_v2.py b/openstackclient/api/image_v2.py index 37c2ed83..d8bb2801 100644 --- a/openstackclient/api/image_v2.py +++ b/openstackclient/api/image_v2.py @@ -19,11 +19,12 @@ from openstackclient.api import image_v1 class APIv2(image_v1.APIv1): """Image v2 API""" - def __init__(self, endpoint=None, **kwargs): - super(APIv2, self).__init__(endpoint=endpoint, **kwargs) + _endpoint_suffix = 'v2' + def _munge_url(self): # 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( self, |
