It was removed urllib, urllib2 & urlparse modules
Those modules have been combined in python 3. Therefore, implementing the six module helps to have support to both versions. Change-Id: I164a0f19790ff066d16d0cf4f0daa6f1097c848e Closes-Bug: #1267181
This commit is contained in:
@@ -15,8 +15,9 @@
|
||||
|
||||
import copy
|
||||
import json
|
||||
|
||||
import six
|
||||
import urllib
|
||||
from six.moves.urllib import parse
|
||||
|
||||
from glanceclient.common import base
|
||||
from glanceclient.common import utils
|
||||
@@ -112,7 +113,7 @@ class ImageManager(base.Manager):
|
||||
|
||||
image_id = base.getid(image)
|
||||
resp, body = self.api.raw_request('HEAD', '/v1/images/%s'
|
||||
% urllib.quote(str(image_id)))
|
||||
% parse.quote(str(image_id)))
|
||||
meta = self._image_meta_from_headers(dict(resp.getheaders()))
|
||||
return Image(self, meta)
|
||||
|
||||
@@ -125,7 +126,7 @@ class ImageManager(base.Manager):
|
||||
"""
|
||||
image_id = base.getid(image)
|
||||
resp, body = self.api.raw_request('GET', '/v1/images/%s'
|
||||
% urllib.quote(str(image_id)))
|
||||
% parse.quote(str(image_id)))
|
||||
checksum = resp.getheader('x-image-meta-checksum', None)
|
||||
if do_checksum and checksum is not None:
|
||||
body.set_checksum(checksum)
|
||||
@@ -171,7 +172,7 @@ class ImageManager(base.Manager):
|
||||
# trying to encode them
|
||||
qp[param] = strutils.safe_encode(value)
|
||||
|
||||
url = '/v1/images/detail?%s' % urllib.urlencode(qp)
|
||||
url = '/v1/images/detail?%s' % parse.urlencode(qp)
|
||||
images = self._list(url, "images")
|
||||
for image in images:
|
||||
if filter_owner(owner, image):
|
||||
|
||||
@@ -22,7 +22,8 @@ from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import urlparse
|
||||
|
||||
from six.moves.urllib import parse
|
||||
|
||||
from glanceclient.common import utils
|
||||
|
||||
@@ -75,7 +76,7 @@ def print_image_formatted(client, image):
|
||||
:param client: The Glance client object
|
||||
:param image: The image metadata
|
||||
"""
|
||||
uri_parts = urlparse.urlparse(client.http_client.endpoint)
|
||||
uri_parts = parse.urlparse(client.http_client.endpoint)
|
||||
if uri_parts.port:
|
||||
hostbase = "%s:%s" % (uri_parts.hostname, uri_parts.port)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user