Remove usage of module py3kcompat
Module py3kcompat was removed from oslo-incubator. We need remove its usage in client side firstly. This make us move smoothly when sync oslo-incubator code. Change-Id: I8b07c32c9852e747579a23685f3c8a07ac13ec01 Partial-Bug: #1280033
This commit is contained in:
parent
bd72fb0a2e
commit
d44e598692
@ -30,9 +30,10 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import exceptions
|
from novaclient import exceptions
|
||||||
from novaclient.openstack.common.gettextutils import _
|
from novaclient.openstack.common.gettextutils import _
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient import service_catalog
|
from novaclient import service_catalog
|
||||||
from novaclient import utils
|
from novaclient import utils
|
||||||
|
|
||||||
@ -325,7 +326,7 @@ class HTTPClient(object):
|
|||||||
extract_token=False)
|
extract_token=False)
|
||||||
|
|
||||||
def authenticate(self):
|
def authenticate(self):
|
||||||
magic_tuple = urlutils.urlsplit(self.auth_url)
|
magic_tuple = parse.urlsplit(self.auth_url)
|
||||||
scheme, netloc, path, query, frag = magic_tuple
|
scheme, netloc, path, query, frag = magic_tuple
|
||||||
port = magic_tuple.port
|
port = magic_tuple.port
|
||||||
if port is None:
|
if port is None:
|
||||||
@ -343,7 +344,7 @@ class HTTPClient(object):
|
|||||||
# TODO(sandy): Assume admin endpoint is 35357 for now.
|
# TODO(sandy): Assume admin endpoint is 35357 for now.
|
||||||
# Ideally this is going to have to be provided by the service catalog.
|
# Ideally this is going to have to be provided by the service catalog.
|
||||||
new_netloc = netloc.replace(':%d' % port, ':%d' % (35357,))
|
new_netloc = netloc.replace(':%d' % port, ':%d' % (35357,))
|
||||||
admin_url = urlutils.urlunsplit(
|
admin_url = parse.urlunsplit(
|
||||||
(scheme, new_netloc, path, query, frag))
|
(scheme, new_netloc, path, query, frag))
|
||||||
|
|
||||||
auth_url = self.auth_url
|
auth_url = self.auth_url
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import client as base_client
|
from novaclient import client as base_client
|
||||||
from novaclient import exceptions
|
from novaclient import exceptions
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient.openstack.common import strutils
|
from novaclient.openstack.common import strutils
|
||||||
from novaclient.tests import fakes
|
from novaclient.tests import fakes
|
||||||
from novaclient.tests import utils
|
from novaclient.tests import utils
|
||||||
@ -64,7 +64,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||||||
assert 'body' in kwargs
|
assert 'body' in kwargs
|
||||||
|
|
||||||
# Call the method
|
# Call the method
|
||||||
args = urlutils.parse_qsl(urlutils.urlparse(url)[4])
|
args = parse.parse_qsl(parse.urlparse(url)[4])
|
||||||
kwargs.update(args)
|
kwargs.update(args)
|
||||||
munged_url = url.rsplit('?', 1)[0]
|
munged_url = url.rsplit('?', 1)[0]
|
||||||
munged_url = munged_url.strip('/').replace('/', '_').replace('.', '_')
|
munged_url = munged_url.strip('/').replace('/', '_').replace('.', '_')
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
migration interface
|
migration interface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.gettextutils import _
|
from novaclient.openstack.common.gettextutils import _
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient import utils
|
from novaclient import utils
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ class MigrationManager(base.ManagerWithFind):
|
|||||||
# order, then the encoded string will be consistent in Python 2&3.
|
# order, then the encoded string will be consistent in Python 2&3.
|
||||||
new_opts = sorted(opts.items(), key=lambda x: x[0])
|
new_opts = sorted(opts.items(), key=lambda x: x[0])
|
||||||
|
|
||||||
query_string = "?%s" % urlutils.urlencode(new_opts) if new_opts else ""
|
query_string = "?%s" % parse.urlencode(new_opts) if new_opts else ""
|
||||||
|
|
||||||
return self._list("/os-migrations%s" % query_string, "migrations")
|
return self._list("/os-migrations%s" % query_string, "migrations")
|
||||||
|
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
Flavor interface.
|
Flavor interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient import exceptions
|
from novaclient import exceptions
|
||||||
from novaclient.openstack.common.gettextutils import _
|
from novaclient.openstack.common.gettextutils import _
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient.openstack.common import strutils
|
from novaclient.openstack.common import strutils
|
||||||
from novaclient import utils
|
from novaclient import utils
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ class FlavorManager(base.ManagerWithFind):
|
|||||||
# and flavors from their own projects only.
|
# and flavors from their own projects only.
|
||||||
if not is_public:
|
if not is_public:
|
||||||
qparams['is_public'] = is_public
|
qparams['is_public'] = is_public
|
||||||
query_string = "?%s" % urlutils.urlencode(qparams) if qparams else ""
|
query_string = "?%s" % parse.urlencode(qparams) if qparams else ""
|
||||||
|
|
||||||
detail = ""
|
detail = ""
|
||||||
if detailed:
|
if detailed:
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
def _quote_domain(domain):
|
def _quote_domain(domain):
|
||||||
@ -24,7 +25,7 @@ def _quote_domain(domain):
|
|||||||
but Routes tends to choke on them, so we need an extra level of
|
but Routes tends to choke on them, so we need an extra level of
|
||||||
by-hand quoting here.
|
by-hand quoting here.
|
||||||
"""
|
"""
|
||||||
return urlutils.quote(domain.replace('.', '%2E'))
|
return parse.quote(domain.replace('.', '%2E'))
|
||||||
|
|
||||||
|
|
||||||
class FloatingIPDNSDomain(base.Resource):
|
class FloatingIPDNSDomain(base.Resource):
|
||||||
@ -101,7 +102,7 @@ class FloatingIPDNSEntryManager(base.Manager):
|
|||||||
def get_for_ip(self, domain, ip):
|
def get_for_ip(self, domain, ip):
|
||||||
"""Return a list of entries for the given domain and ip or name."""
|
"""Return a list of entries for the given domain and ip or name."""
|
||||||
qparams = {'ip': ip}
|
qparams = {'ip': ip}
|
||||||
params = "?%s" % urlutils.urlencode(qparams)
|
params = "?%s" % parse.urlencode(qparams)
|
||||||
|
|
||||||
return self._list("/os-floating-ip-dns/%s/entries%s" %
|
return self._list("/os-floating-ip-dns/%s/entries%s" %
|
||||||
(_quote_domain(domain), params),
|
(_quote_domain(domain), params),
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
Hypervisors interface (1.1 extension).
|
Hypervisors interface (1.1 extension).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
class Hypervisor(base.Resource):
|
class Hypervisor(base.Resource):
|
||||||
@ -48,7 +49,7 @@ class HypervisorManager(base.ManagerWithFind):
|
|||||||
"""
|
"""
|
||||||
target = 'servers' if servers else 'search'
|
target = 'servers' if servers else 'search'
|
||||||
url = ('/os-hypervisors/%s/%s' %
|
url = ('/os-hypervisors/%s/%s' %
|
||||||
(urlutils.quote(hypervisor_match, safe=''), target))
|
(parse.quote(hypervisor_match, safe=''), target))
|
||||||
return self._list(url, 'hypervisors')
|
return self._list(url, 'hypervisors')
|
||||||
|
|
||||||
def get(self, hypervisor):
|
def get(self, hypervisor):
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
"""
|
"""
|
||||||
Image interface.
|
Image interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
class Image(base.Resource):
|
class Image(base.Resource):
|
||||||
@ -63,7 +65,7 @@ class ImageManager(base.ManagerWithFind):
|
|||||||
detail = '/detail'
|
detail = '/detail'
|
||||||
if limit:
|
if limit:
|
||||||
params['limit'] = int(limit)
|
params['limit'] = int(limit)
|
||||||
query = '?%s' % urlutils.urlencode(params) if params else ''
|
query = '?%s' % parse.urlencode(params) if params else ''
|
||||||
return self._list('/images%s%s' % (detail, query), 'images')
|
return self._list('/images%s%s' % (detail, query), 'images')
|
||||||
|
|
||||||
def delete(self, image):
|
def delete(self, image):
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
class Limits(base.Resource):
|
class Limits(base.Resource):
|
||||||
@ -94,6 +95,6 @@ class LimitsManager(base.Manager):
|
|||||||
opts['reserved'] = 1
|
opts['reserved'] = 1
|
||||||
if tenant_id:
|
if tenant_id:
|
||||||
opts['tenant_id'] = tenant_id
|
opts['tenant_id'] = tenant_id
|
||||||
query_string = "?%s" % urlutils.urlencode(opts) if opts else ""
|
query_string = "?%s" % parse.urlencode(opts) if opts else ""
|
||||||
|
|
||||||
return self._get("/limits%s" % query_string, "limits")
|
return self._get("/limits%s" % query_string, "limits")
|
||||||
|
@ -18,9 +18,9 @@ Security group interface (1.1 extension).
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
class SecurityGroup(base.Resource):
|
class SecurityGroup(base.Resource):
|
||||||
@ -90,7 +90,7 @@ class SecurityGroupManager(base.ManagerWithFind):
|
|||||||
|
|
||||||
qparams = dict((k, v) for (k, v) in six.iteritems(search_opts) if v)
|
qparams = dict((k, v) for (k, v) in six.iteritems(search_opts) if v)
|
||||||
|
|
||||||
query_string = '?%s' % urlutils.urlencode(qparams) if qparams else ''
|
query_string = '?%s' % parse.urlencode(qparams) if qparams else ''
|
||||||
|
|
||||||
return self._list('/os-security-groups%s' % query_string,
|
return self._list('/os-security-groups%s' % query_string,
|
||||||
'security_groups')
|
'security_groups')
|
||||||
|
@ -22,10 +22,10 @@ Server interface.
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient import crypto
|
from novaclient import crypto
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient.openstack.common import strutils
|
from novaclient.openstack.common import strutils
|
||||||
from novaclient.v1_1.security_groups import SecurityGroup
|
from novaclient.v1_1.security_groups import SecurityGroup
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ class ServerManager(base.BootingManagerWithFind):
|
|||||||
# order, then the encoded string will be consistent in Python 2&3.
|
# order, then the encoded string will be consistent in Python 2&3.
|
||||||
if qparams:
|
if qparams:
|
||||||
new_qparams = sorted(qparams.items(), key=lambda x: x[0])
|
new_qparams = sorted(qparams.items(), key=lambda x: x[0])
|
||||||
query_string = "?%s" % urlutils.urlencode(new_qparams)
|
query_string = "?%s" % parse.urlencode(new_qparams)
|
||||||
else:
|
else:
|
||||||
query_string = ""
|
query_string = ""
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ Volume interface (1.1 extension).
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
|
|
||||||
|
|
||||||
class Volume(base.Resource):
|
class Volume(base.Resource):
|
||||||
@ -89,7 +89,7 @@ class VolumeManager(base.ManagerWithFind):
|
|||||||
|
|
||||||
qparams = dict((k, v) for (k, v) in six.iteritems(search_opts) if v)
|
qparams = dict((k, v) for (k, v) in six.iteritems(search_opts) if v)
|
||||||
|
|
||||||
query_string = '?%s' % urlutils.urlencode(qparams) if qparams else ''
|
query_string = '?%s' % parse.urlencode(qparams) if qparams else ''
|
||||||
|
|
||||||
if detailed is True:
|
if detailed is True:
|
||||||
return self._list("/volumes/detail%s" % query_string, "volumes")
|
return self._list("/volumes/detail%s" % query_string, "volumes")
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
Hypervisors interface
|
Hypervisors interface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient.v1_1 import hypervisors
|
from novaclient.v1_1 import hypervisors
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ class HypervisorManager(hypervisors.HypervisorManager):
|
|||||||
:param servers: If True, server information is also retrieved.
|
:param servers: If True, server information is also retrieved.
|
||||||
"""
|
"""
|
||||||
url = ('/os-hypervisors/search?query=%s' %
|
url = ('/os-hypervisors/search?query=%s' %
|
||||||
urlutils.quote(hypervisor_match, safe=''))
|
parse.quote(hypervisor_match, safe=''))
|
||||||
return self._list(url, 'hypervisors')
|
return self._list(url, 'hypervisors')
|
||||||
|
|
||||||
def servers(self, hypervisor):
|
def servers(self, hypervisor):
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
"""
|
"""
|
||||||
Image interface.
|
Image interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient.openstack.common import strutils
|
from novaclient.openstack.common import strutils
|
||||||
|
|
||||||
|
|
||||||
@ -100,5 +102,5 @@ class ImageManager(base.ManagerWithFind):
|
|||||||
detail = '/detail'
|
detail = '/detail'
|
||||||
if limit:
|
if limit:
|
||||||
params['limit'] = int(limit)
|
params['limit'] = int(limit)
|
||||||
query = '?%s' % urlutils.urlencode(params) if params else ''
|
query = '?%s' % parse.urlencode(params) if params else ''
|
||||||
return self._list('/v1/images%s%s' % (detail, query), 'images')
|
return self._list('/v1/images%s%s' % (detail, query), 'images')
|
||||||
|
@ -22,10 +22,10 @@ Server interface.
|
|||||||
import base64
|
import base64
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from novaclient import base
|
from novaclient import base
|
||||||
from novaclient import crypto
|
from novaclient import crypto
|
||||||
from novaclient.openstack.common.py3kcompat import urlutils
|
|
||||||
from novaclient.openstack.common import strutils
|
from novaclient.openstack.common import strutils
|
||||||
|
|
||||||
REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'
|
REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'
|
||||||
@ -507,7 +507,7 @@ class ServerManager(base.BootingManagerWithFind):
|
|||||||
# order, then the encoded string will be consistent in Python 2&3.
|
# order, then the encoded string will be consistent in Python 2&3.
|
||||||
if qparams:
|
if qparams:
|
||||||
new_qparams = sorted(qparams.items(), key=lambda x: x[0])
|
new_qparams = sorted(qparams.items(), key=lambda x: x[0])
|
||||||
query_string = "?%s" % urlutils.urlencode(new_qparams)
|
query_string = "?%s" % parse.urlencode(new_qparams)
|
||||||
else:
|
else:
|
||||||
query_string = ""
|
query_string = ""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user