diff --git a/novaclient/client.py b/novaclient/client.py index 52ed3cb23..159255540 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -404,7 +404,7 @@ class HTTPClient(object): # a nova endpoint directly without "v2/". 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: diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py index abde0c0b6..5038e1837 100644 --- a/novaclient/tests/unit/test_client.py +++ b/novaclient/tests/unit/test_client.py @@ -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')