From 078819cf9ea121bbffc71ad0af6b3bea1d897b0b Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 27 Mar 2014 20:57:09 +0000 Subject: [PATCH] Fix for invalid literal ValueError parsing ipv6 url(s) Switch to using network_utils for splitting the URL. The code in oslo-incubator supports ipv6 urls Change-Id: I76be6173b97eb000319d30b4e9232a5a7c4a5aba Closes-Bug: #1298137 --- glanceclient/common/http.py | 3 ++- tests/test_http.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 2dc28408..d1dc61de 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -39,6 +39,7 @@ import OpenSSL from glanceclient.common import utils from glanceclient import exc +from glanceclient.openstack.common import network_utils from glanceclient.openstack.common import strutils try: @@ -85,7 +86,7 @@ class HTTPClient(object): @staticmethod def parse_endpoint(endpoint): - return parse.urlparse(endpoint) + return network_utils.urlsplit(endpoint) @staticmethod def get_connection_class(scheme): diff --git a/tests/test_http.py b/tests/test_http.py index e439ede0..e68dc093 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -304,9 +304,9 @@ class TestClient(testtools.TestCase): endpoint = 'http://example.com:9292' test_client = http.HTTPClient(endpoint, token=u'adc123') actual = test_client.parse_endpoint(endpoint) - expected = parse.ParseResult(scheme='http', + expected = parse.SplitResult(scheme='http', netloc='example.com:9292', path='', - params='', query='', fragment='') + query='', fragment='') self.assertEqual(expected, actual) def test_get_connection_class(self):