diff --git a/contrib/rackspace/rackspace/clients.py b/contrib/rackspace/rackspace/clients.py index d2d6fb8be9..c165daaa95 100644 --- a/contrib/rackspace/rackspace/clients.py +++ b/contrib/rackspace/rackspace/clients.py @@ -16,11 +16,11 @@ import hashlib import random import time -import urlparse from glanceclient import client as gc from oslo_config import cfg from oslo_log import log as logging +from six.moves.urllib import parse from swiftclient import utils as swiftclient_utils from troveclient import client as tc @@ -220,7 +220,7 @@ class RackspaceSwiftClient(swift.SwiftClientPlugin): timeout = swift.MAX_EPOCH - 60 - time.time() tempurl = swiftclient_utils.generate_temp_url(path, timeout, key, method) - sw_url = urlparse.urlparse(self.client().url) + sw_url = parse.urlparse(self.client().url) return '%s://%s%s' % (sw_url.scheme, sw_url.netloc, tempurl) @@ -235,7 +235,7 @@ class RackspaceGlanceClient(glance.GlanceClientPlugin): region_name=cfg.CONF.region_name_for_services) # Rackspace service catalog includes a tenant scoped glance # endpoint so we have to munge the url a bit - glance_url = urlparse.urlparse(endpoint) + glance_url = parse.urlparse(endpoint) # remove the tenant and following from the url endpoint = "%s://%s" % (glance_url.scheme, glance_url.hostname) args = { diff --git a/heat/api/cfn/versions.py b/heat/api/cfn/versions.py index 6f5763cdf9..ffd7f945ee 100644 --- a/heat/api/cfn/versions.py +++ b/heat/api/cfn/versions.py @@ -15,9 +15,8 @@ Controller that returns information on the heat API versions """ -import httplib - from oslo_serialization import jsonutils +from six.moves import http_client import webob.dec @@ -47,7 +46,7 @@ class Controller(object): body = jsonutils.dumps(dict(versions=version_objs)) response = webob.Response(request=req, - status=httplib.MULTIPLE_CHOICES, + status=http_client.MULTIPLE_CHOICES, content_type='application/json') response.body = body diff --git a/heat/api/cloudwatch/versions.py b/heat/api/cloudwatch/versions.py index 3e64ecdec4..f326d09086 100644 --- a/heat/api/cloudwatch/versions.py +++ b/heat/api/cloudwatch/versions.py @@ -13,9 +13,8 @@ """Controller that returns information on the heat API versions.""" -import httplib - from oslo_serialization import jsonutils +from six.moves import http_client import webob.dec @@ -43,7 +42,7 @@ class Controller(object): body = jsonutils.dumps(dict(versions=version_objs)) response = webob.Response(request=req, - status=httplib.MULTIPLE_CHOICES, + status=http_client.MULTIPLE_CHOICES, content_type='application/json') response.body = body diff --git a/heat/api/openstack/versions.py b/heat/api/openstack/versions.py index 6f5763cdf9..ffd7f945ee 100644 --- a/heat/api/openstack/versions.py +++ b/heat/api/openstack/versions.py @@ -15,9 +15,8 @@ Controller that returns information on the heat API versions """ -import httplib - from oslo_serialization import jsonutils +from six.moves import http_client import webob.dec @@ -47,7 +46,7 @@ class Controller(object): body = jsonutils.dumps(dict(versions=version_objs)) response = webob.Response(request=req, - status=httplib.MULTIPLE_CHOICES, + status=http_client.MULTIPLE_CHOICES, content_type='application/json') response.body = body diff --git a/heat/engine/clients/os/swift.py b/heat/engine/clients/os/swift.py index 38e90b8817..65a290ad12 100644 --- a/heat/engine/clients/os/swift.py +++ b/heat/engine/clients/os/swift.py @@ -16,8 +16,8 @@ import email.utils import hashlib import random import time -import urlparse +from six.moves.urllib import parse from swiftclient import client as sc from swiftclient import exceptions from swiftclient import utils as swiftclient_utils @@ -106,7 +106,7 @@ class SwiftClientPlugin(client_plugin.ClientPlugin): timeout = MAX_EPOCH - 60 - time.time() tempurl = swiftclient_utils.generate_temp_url(path, timeout, key, method) - sw_url = urlparse.urlparse(self.client().url) + sw_url = parse.urlparse(self.client().url) return '%s://%s%s' % (sw_url.scheme, sw_url.netloc, tempurl) def get_signal_url(self, container_name, obj_name, timeout=None): diff --git a/heat/engine/resources/openstack/heat/swiftsignal.py b/heat/engine/resources/openstack/heat/swiftsignal.py index 7bb860a7d2..ba7abc6904 100644 --- a/heat/engine/resources/openstack/heat/swiftsignal.py +++ b/heat/engine/resources/openstack/heat/swiftsignal.py @@ -11,12 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. -import urlparse - from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import timeutils import six +from six.moves.urllib import parse from heat.common import exception from heat.common.i18n import _ @@ -204,7 +203,7 @@ class SwiftSignal(resource.Resource): @property def url(self): if not self._url: - self._url = urlparse.urlparse(self.properties[self.HANDLE]) + self._url = parse.urlparse(self.properties[self.HANDLE]) return self._url @property diff --git a/heat_integrationtests/common/remote_client.py b/heat_integrationtests/common/remote_client.py index f0405b8fbe..c8c4f95230 100644 --- a/heat_integrationtests/common/remote_client.py +++ b/heat_integrationtests/common/remote_client.py @@ -10,7 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -import cStringIO import re import select import socket @@ -34,7 +33,7 @@ class Client(object): self.password = password if isinstance(pkey, six.string_types): pkey = paramiko.RSAKey.from_private_key( - cStringIO.StringIO(str(pkey))) + six.moves.cStringIO(str(pkey))) self.pkey = pkey self.look_for_keys = look_for_keys self.key_filename = key_filename diff --git a/heat_integrationtests/common/test.py b/heat_integrationtests/common/test.py index a7aa039543..ed1e25437f 100644 --- a/heat_integrationtests/common/test.py +++ b/heat_integrationtests/common/test.py @@ -15,13 +15,13 @@ import random import re import subprocess import time -import urllib import fixtures from heatclient import exc as heat_exceptions from oslo_log import log as logging from oslo_utils import timeutils import six +from six.moves import urllib import testscenarios import testtools @@ -111,7 +111,7 @@ class HeatIntegrationTest(testscenarios.WithScenarios, def check_connectivity(self, check_ip): def try_connect(ip): try: - urllib.urlopen('http://%s/' % ip) + urllib.request.urlopen('http://%s/' % ip) return True except IOError: return False diff --git a/heat_integrationtests/functional/test_aws_stack.py b/heat_integrationtests/functional/test_aws_stack.py index d8ba937e3e..172bc24f4e 100644 --- a/heat_integrationtests/functional/test_aws_stack.py +++ b/heat_integrationtests/functional/test_aws_stack.py @@ -13,9 +13,9 @@ import hashlib import json import random -import urlparse from oslo_log import log as logging +from six.moves.urllib import parse from swiftclient import utils as swiftclient_utils import yaml @@ -103,7 +103,7 @@ Outputs: timeout = self.conf.build_timeout * 10 tempurl = swiftclient_utils.generate_temp_url(path, timeout, key, 'GET') - sw_url = urlparse.urlparse(oc.url) + sw_url = parse.urlparse(oc.url) return '%s://%s%s' % (sw_url.scheme, sw_url.netloc, tempurl) def test_nested_stack_create(self): diff --git a/heat_integrationtests/scenario/test_neutron_loadbalancer.py b/heat_integrationtests/scenario/test_neutron_loadbalancer.py index fafa9bea6f..1cb1c6f54e 100644 --- a/heat_integrationtests/scenario/test_neutron_loadbalancer.py +++ b/heat_integrationtests/scenario/test_neutron_loadbalancer.py @@ -12,7 +12,8 @@ # under the License. import time -import urllib + +from six.moves import urllib from heat_integrationtests.scenario import scenario_base @@ -31,7 +32,7 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase): resp = set() for count in range(10): time.sleep(1) - resp.add(urllib.urlopen('http://%s/' % ip).read()) + resp.add(urllib.request.urlopen('http://%s/' % ip).read()) self.assertEqual(expected_resp, resp)