Skip to content

Commit b957ba8

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fixes image api URL endpoint for certain scenario"
2 parents 5750ff9 + 1bd2bf6 commit b957ba8

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

openstackclient/api/image_v1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class APIv1(api.BaseAPI):
2020
"""Image v1 API"""
2121

22-
_endpoint_suffix = 'v1'
22+
_endpoint_suffix = '/v1'
2323

2424
def __init__(self, endpoint=None, **kwargs):
2525
super(APIv1, self).__init__(endpoint=endpoint, **kwargs)
@@ -29,8 +29,8 @@ def __init__(self, endpoint=None, **kwargs):
2929

3030
def _munge_url(self):
3131
# Hack this until discovery is up
32-
if self._endpoint_suffix not in self.endpoint.split('/')[-1]:
33-
self.endpoint = '/'.join([self.endpoint, self._endpoint_suffix])
32+
if not self.endpoint.endswith(self._endpoint_suffix):
33+
self.endpoint = self.endpoint + self._endpoint_suffix
3434

3535
def image_list(
3636
self,

openstackclient/api/image_v2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
class APIv2(image_v1.APIv1):
2020
"""Image v2 API"""
2121

22-
_endpoint_suffix = 'v2'
22+
_endpoint_suffix = '/v2'
2323

2424
def _munge_url(self):
2525
# Hack this until discovery is up, and ignore parent endpoint setting
26-
if 'v2' not in self.endpoint.split('/')[-1]:
27-
self.endpoint = '/'.join([self.endpoint, 'v2'])
26+
if not self.endpoint.endswith(self._endpoint_suffix):
27+
self.endpoint = self.endpoint + self._endpoint_suffix
2828

2929
def image_list(
3030
self,

openstackclient/tests/unit/api/test_image_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
FAKE_PROJECT = 'xyzpdq'
24-
FAKE_URL = 'http://gopher.com'
24+
FAKE_URL = 'http://gopher.dev10.com'
2525

2626

2727
class TestImageAPIv1(utils.TestCase):

openstackclient/tests/unit/api/test_image_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
FAKE_PROJECT = 'xyzpdq'
24-
FAKE_URL = 'http://gopher.com'
24+
FAKE_URL = 'http://gopher.dev20.com'
2525

2626

2727
class TestImageAPIv2(utils.TestCase):

0 commit comments

Comments
 (0)