Update urllib/httplib/cStringIO to use six.moves

partial blueprint heat-python34-support

Change-Id: I00a7064560a95a33dcb1e621961765822d4e94d4
This commit is contained in:
Sirushti Murugesan 2015-04-22 00:35:26 +05:30
parent 11f835b8ef
commit 19ce39d101
10 changed files with 21 additions and 25 deletions

View File

@ -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 = {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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)