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
This commit is contained in:
parent
58ee451286
commit
078819cf9e
|
@ -39,6 +39,7 @@ import OpenSSL
|
||||||
|
|
||||||
from glanceclient.common import utils
|
from glanceclient.common import utils
|
||||||
from glanceclient import exc
|
from glanceclient import exc
|
||||||
|
from glanceclient.openstack.common import network_utils
|
||||||
from glanceclient.openstack.common import strutils
|
from glanceclient.openstack.common import strutils
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -85,7 +86,7 @@ class HTTPClient(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_endpoint(endpoint):
|
def parse_endpoint(endpoint):
|
||||||
return parse.urlparse(endpoint)
|
return network_utils.urlsplit(endpoint)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_connection_class(scheme):
|
def get_connection_class(scheme):
|
||||||
|
|
|
@ -304,9 +304,9 @@ class TestClient(testtools.TestCase):
|
||||||
endpoint = 'http://example.com:9292'
|
endpoint = 'http://example.com:9292'
|
||||||
test_client = http.HTTPClient(endpoint, token=u'adc123')
|
test_client = http.HTTPClient(endpoint, token=u'adc123')
|
||||||
actual = test_client.parse_endpoint(endpoint)
|
actual = test_client.parse_endpoint(endpoint)
|
||||||
expected = parse.ParseResult(scheme='http',
|
expected = parse.SplitResult(scheme='http',
|
||||||
netloc='example.com:9292', path='',
|
netloc='example.com:9292', path='',
|
||||||
params='', query='', fragment='')
|
query='', fragment='')
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
def test_get_connection_class(self):
|
def test_get_connection_class(self):
|
||||||
|
|
Loading…
Reference in New Issue