Merge "Fix versions.list for v2.1 Nova API"

This commit is contained in:
Jenkins 2015-08-24 23:19:10 +00:00 committed by Gerrit Code Review
commit 72190ba9a2
2 changed files with 7 additions and 1 deletions

View File

@ -404,7 +404,7 @@ class HTTPClient(object):
# a nova endpoint directly without "v2/<tenant-id>".
magic_tuple = parse.urlsplit(self.management_url)
scheme, netloc, path, query, frag = magic_tuple
path = re.sub(r'v[1-9]/[a-z0-9]+$', '', path)
path = re.sub(r'v[1-9](\.[1-9][0-9]*)?/[a-z0-9]+$', '', path)
url = parse.urlunsplit((scheme, netloc, path, None, None))
else:
if self.service_catalog and not self.bypass_url:

View File

@ -137,10 +137,16 @@ class ClientTest(utils.TestCase):
def test_client_version_url(self):
self._check_version_url('http://foo.com/v2/%s', 'http://foo.com/')
self._check_version_url('http://foo.com/v2.1/%s', 'http://foo.com/')
self._check_version_url('http://foo.com/v3.785/%s', 'http://foo.com/')
def test_client_version_url_with_project_name(self):
self._check_version_url('http://foo.com/nova/v2/%s',
'http://foo.com/nova/')
self._check_version_url('http://foo.com/nova/v2.1/%s',
'http://foo.com/nova/')
self._check_version_url('http://foo.com/nova/v3.785/%s',
'http://foo.com/nova/')
def test_get_client_class_v2(self):
output = novaclient.client.get_client_class('2')