diff --git a/nova/api/openstack/compute/floating_ip_dns.py b/nova/api/openstack/compute/floating_ip_dns.py index 5da98a1b7a27..ae545b45f211 100644 --- a/nova/api/openstack/compute/floating_ip_dns.py +++ b/nova/api/openstack/compute/floating_ip_dns.py @@ -12,9 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib - from oslo_utils import netutils +from six.moves import urllib import webob from nova.api.openstack import common @@ -68,7 +67,7 @@ def _unquote_domain(domain): but Routes tends to choke on them, so we need an extra level of by-hand quoting here. """ - return urllib.unquote(domain).replace('%2E', '.') + return urllib.parse.unquote(domain).replace('%2E', '.') def _create_dns_entry(ip, name, domain): diff --git a/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py b/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py index e46254e1f9eb..b46254267946 100644 --- a/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py +++ b/nova/api/openstack/compute/legacy_v2/contrib/floating_ip_dns.py @@ -12,9 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib - from oslo_utils import netutils +from six.moves import urllib import webob from nova.api.openstack import extensions @@ -65,7 +64,7 @@ def _unquote_domain(domain): but Routes tends to choke on them, so we need an extra level of by-hand quoting here. """ - return urllib.unquote(domain).replace('%2E', '.') + return urllib.parse.unquote(domain).replace('%2E', '.') def _create_dns_entry(ip, name, domain): diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py index f063749b4454..e79313a1f7e8 100644 --- a/nova/cmd/manage.py +++ b/nova/cmd/manage.py @@ -57,7 +57,6 @@ from __future__ import print_function import argparse import os import sys -import urllib import decorator import netaddr @@ -1086,7 +1085,7 @@ class CellCommands(object): is_parent = True values = {'name': name, 'is_parent': is_parent, - 'transport_url': urllib.unquote(str(transport_url)), + 'transport_url': urlparse.unquote(str(transport_url)), 'weight_offset': float(woffset), 'weight_scale': float(wscale)} ctxt = context.get_admin_context() diff --git a/nova/network/security_group/security_group_base.py b/nova/network/security_group/security_group_base.py index 7d17e7c66211..0a0cc3b782c1 100644 --- a/nova/network/security_group/security_group_base.py +++ b/nova/network/security_group/security_group_base.py @@ -17,7 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves import urllib from nova import exception from nova.i18n import _ @@ -32,7 +32,7 @@ class SecurityGroupBase(object): def parse_cidr(self, cidr): if cidr: try: - cidr = urllib.unquote(cidr).decode() + cidr = urllib.parse.unquote(cidr).decode() except Exception as e: self.raise_invalid_cidr(cidr, e) diff --git a/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py b/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py index 67c78733b526..ef00558caaf6 100644 --- a/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py +++ b/nova/tests/functional/api_sample_tests/test_instance_usage_audit_log.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves import urllib import nova.conf from nova.tests.functional.api_sample_tests import api_sample_base @@ -35,7 +35,7 @@ class InstanceUsageAuditLogJsonTest(api_sample_base.ApiSampleTestBaseV21): def test_show_instance_usage_audit_log(self): response = self._do_get('os-instance_usage_audit_log/%s' % - urllib.quote('2012-07-05 10:00:00')) + urllib.parse.quote('2012-07-05 10:00:00')) self._verify_response('inst-usage-audit-log-show-get-resp', {}, response, 200) diff --git a/nova/tests/unit/api/openstack/compute/test_floating_ip_dns.py b/nova/tests/unit/api/openstack/compute/test_floating_ip_dns.py index cc86b8c03457..ca55c185ee6d 100644 --- a/nova/tests/unit/api/openstack/compute/test_floating_ip_dns.py +++ b/nova/tests/unit/api/openstack/compute/test_floating_ip_dns.py @@ -14,9 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib - import mock +from six.moves import urllib import webob from nova.api.openstack.compute import floating_ip_dns \ @@ -48,7 +47,7 @@ def _quote_domain(domain): by-hand quoting here. This function needs to duplicate the one in python-novaclient/novaclient/v1_1/floating_ip_dns.py """ - return urllib.quote(domain.replace('.', '%2E')) + return urllib.parse.quote(domain.replace('.', '%2E')) def network_api_get_floating_ip(self, context, id): diff --git a/nova/virt/libvirt/storage/rbd_utils.py b/nova/virt/libvirt/storage/rbd_utils.py index 1e78f5c3d7ee..7052428d7344 100644 --- a/nova/virt/libvirt/storage/rbd_utils.py +++ b/nova/virt/libvirt/storage/rbd_utils.py @@ -14,9 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib - from eventlet import tpool +from six.moves import urllib try: import rados @@ -168,7 +167,7 @@ class RBDDriver(object): if not url.startswith(prefix): reason = _('Not stored in rbd') raise exception.ImageUnacceptable(image_id=url, reason=reason) - pieces = map(urllib.unquote, url[len(prefix):].split('/')) + pieces = map(urllib.parse.unquote, url[len(prefix):].split('/')) if '' in pieces: reason = _('Blank components') raise exception.ImageUnacceptable(image_id=url, reason=reason) diff --git a/tests-py3.txt b/tests-py3.txt index 6a6d49347290..125733ca7c79 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -23,8 +23,6 @@ nova.tests.unit.api.openstack.compute.test_extended_server_attributes.ExtendedSe nova.tests.unit.api.openstack.compute.test_extended_server_attributes.ExtendedServerAttributesTestV23 nova.tests.unit.api.openstack.compute.test_floating_ip_dns.FloatingIPDNSDomainPolicyEnforcementV21 nova.tests.unit.api.openstack.compute.test_floating_ip_dns.FloatingIPDNSEntryPolicyEnforcementV21 -nova.tests.unit.api.openstack.compute.test_floating_ip_dns.FloatingIpDNSTestV2 -nova.tests.unit.api.openstack.compute.test_floating_ip_dns.FloatingIpDNSTestV21 nova.tests.unit.api.openstack.compute.test_hide_server_addresses.HideServerAddressesTestV2 nova.tests.unit.api.openstack.compute.test_hide_server_addresses.HideServerAddressesTestV21 nova.tests.unit.api.openstack.compute.test_keypairs.KeypairsTestV2 @@ -102,7 +100,6 @@ nova.tests.unit.test_metadata.MetadataHandlerTestCase nova.tests.unit.test_metadata.MetadataPasswordTestCase nova.tests.unit.test_metadata.MetadataTestCase nova.tests.unit.test_metadata.OpenStackMetadataTestCase -nova.tests.unit.test_nova_manage.CellCommandsTestCase nova.tests.unit.test_pipelib.PipelibTest nova.tests.unit.test_policy.AdminRolePolicyTestCase nova.tests.unit.test_quota.QuotaIntegrationTestCase