Update urllib/httplib/cStringIO to use six.moves
partial blueprint heat-python34-support Change-Id: I00a7064560a95a33dcb1e621961765822d4e94d4
This commit is contained in:
parent
11f835b8ef
commit
19ce39d101
@ -16,11 +16,11 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
import urlparse
|
|
||||||
|
|
||||||
from glanceclient import client as gc
|
from glanceclient import client as gc
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from six.moves.urllib import parse
|
||||||
from swiftclient import utils as swiftclient_utils
|
from swiftclient import utils as swiftclient_utils
|
||||||
from troveclient import client as tc
|
from troveclient import client as tc
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class RackspaceSwiftClient(swift.SwiftClientPlugin):
|
|||||||
timeout = swift.MAX_EPOCH - 60 - time.time()
|
timeout = swift.MAX_EPOCH - 60 - time.time()
|
||||||
tempurl = swiftclient_utils.generate_temp_url(path, timeout, key,
|
tempurl = swiftclient_utils.generate_temp_url(path, timeout, key,
|
||||||
method)
|
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)
|
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)
|
region_name=cfg.CONF.region_name_for_services)
|
||||||
# Rackspace service catalog includes a tenant scoped glance
|
# Rackspace service catalog includes a tenant scoped glance
|
||||||
# endpoint so we have to munge the url a bit
|
# 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
|
# remove the tenant and following from the url
|
||||||
endpoint = "%s://%s" % (glance_url.scheme, glance_url.hostname)
|
endpoint = "%s://%s" % (glance_url.scheme, glance_url.hostname)
|
||||||
args = {
|
args = {
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
Controller that returns information on the heat API versions
|
Controller that returns information on the heat API versions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import httplib
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from six.moves import http_client
|
||||||
import webob.dec
|
import webob.dec
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ class Controller(object):
|
|||||||
body = jsonutils.dumps(dict(versions=version_objs))
|
body = jsonutils.dumps(dict(versions=version_objs))
|
||||||
|
|
||||||
response = webob.Response(request=req,
|
response = webob.Response(request=req,
|
||||||
status=httplib.MULTIPLE_CHOICES,
|
status=http_client.MULTIPLE_CHOICES,
|
||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
response.body = body
|
response.body = body
|
||||||
|
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
|
|
||||||
"""Controller that returns information on the heat API versions."""
|
"""Controller that returns information on the heat API versions."""
|
||||||
|
|
||||||
import httplib
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from six.moves import http_client
|
||||||
import webob.dec
|
import webob.dec
|
||||||
|
|
||||||
|
|
||||||
@ -43,7 +42,7 @@ class Controller(object):
|
|||||||
body = jsonutils.dumps(dict(versions=version_objs))
|
body = jsonutils.dumps(dict(versions=version_objs))
|
||||||
|
|
||||||
response = webob.Response(request=req,
|
response = webob.Response(request=req,
|
||||||
status=httplib.MULTIPLE_CHOICES,
|
status=http_client.MULTIPLE_CHOICES,
|
||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
response.body = body
|
response.body = body
|
||||||
|
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
Controller that returns information on the heat API versions
|
Controller that returns information on the heat API versions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import httplib
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from six.moves import http_client
|
||||||
import webob.dec
|
import webob.dec
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ class Controller(object):
|
|||||||
body = jsonutils.dumps(dict(versions=version_objs))
|
body = jsonutils.dumps(dict(versions=version_objs))
|
||||||
|
|
||||||
response = webob.Response(request=req,
|
response = webob.Response(request=req,
|
||||||
status=httplib.MULTIPLE_CHOICES,
|
status=http_client.MULTIPLE_CHOICES,
|
||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
response.body = body
|
response.body = body
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ import email.utils
|
|||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
import urlparse
|
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
from swiftclient import client as sc
|
from swiftclient import client as sc
|
||||||
from swiftclient import exceptions
|
from swiftclient import exceptions
|
||||||
from swiftclient import utils as swiftclient_utils
|
from swiftclient import utils as swiftclient_utils
|
||||||
@ -106,7 +106,7 @@ class SwiftClientPlugin(client_plugin.ClientPlugin):
|
|||||||
timeout = MAX_EPOCH - 60 - time.time()
|
timeout = MAX_EPOCH - 60 - time.time()
|
||||||
tempurl = swiftclient_utils.generate_temp_url(path, timeout, key,
|
tempurl = swiftclient_utils.generate_temp_url(path, timeout, key,
|
||||||
method)
|
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)
|
return '%s://%s%s' % (sw_url.scheme, sw_url.netloc, tempurl)
|
||||||
|
|
||||||
def get_signal_url(self, container_name, obj_name, timeout=None):
|
def get_signal_url(self, container_name, obj_name, timeout=None):
|
||||||
|
@ -11,12 +11,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urlparse
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
@ -204,7 +203,7 @@ class SwiftSignal(resource.Resource):
|
|||||||
@property
|
@property
|
||||||
def url(self):
|
def url(self):
|
||||||
if not self._url:
|
if not self._url:
|
||||||
self._url = urlparse.urlparse(self.properties[self.HANDLE])
|
self._url = parse.urlparse(self.properties[self.HANDLE])
|
||||||
return self._url
|
return self._url
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import cStringIO
|
|
||||||
import re
|
import re
|
||||||
import select
|
import select
|
||||||
import socket
|
import socket
|
||||||
@ -34,7 +33,7 @@ class Client(object):
|
|||||||
self.password = password
|
self.password = password
|
||||||
if isinstance(pkey, six.string_types):
|
if isinstance(pkey, six.string_types):
|
||||||
pkey = paramiko.RSAKey.from_private_key(
|
pkey = paramiko.RSAKey.from_private_key(
|
||||||
cStringIO.StringIO(str(pkey)))
|
six.moves.cStringIO(str(pkey)))
|
||||||
self.pkey = pkey
|
self.pkey = pkey
|
||||||
self.look_for_keys = look_for_keys
|
self.look_for_keys = look_for_keys
|
||||||
self.key_filename = key_filename
|
self.key_filename = key_filename
|
||||||
|
@ -15,13 +15,13 @@ import random
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import urllib
|
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
from heatclient import exc as heat_exceptions
|
from heatclient import exc as heat_exceptions
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import six
|
import six
|
||||||
|
from six.moves import urllib
|
||||||
import testscenarios
|
import testscenarios
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class HeatIntegrationTest(testscenarios.WithScenarios,
|
|||||||
def check_connectivity(self, check_ip):
|
def check_connectivity(self, check_ip):
|
||||||
def try_connect(ip):
|
def try_connect(ip):
|
||||||
try:
|
try:
|
||||||
urllib.urlopen('http://%s/' % ip)
|
urllib.request.urlopen('http://%s/' % ip)
|
||||||
return True
|
return True
|
||||||
except IOError:
|
except IOError:
|
||||||
return False
|
return False
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import urlparse
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from six.moves.urllib import parse
|
||||||
from swiftclient import utils as swiftclient_utils
|
from swiftclient import utils as swiftclient_utils
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ Outputs:
|
|||||||
timeout = self.conf.build_timeout * 10
|
timeout = self.conf.build_timeout * 10
|
||||||
tempurl = swiftclient_utils.generate_temp_url(path, timeout,
|
tempurl = swiftclient_utils.generate_temp_url(path, timeout,
|
||||||
key, 'GET')
|
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)
|
return '%s://%s%s' % (sw_url.scheme, sw_url.netloc, tempurl)
|
||||||
|
|
||||||
def test_nested_stack_create(self):
|
def test_nested_stack_create(self):
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import urllib
|
|
||||||
|
from six.moves import urllib
|
||||||
|
|
||||||
from heat_integrationtests.scenario import scenario_base
|
from heat_integrationtests.scenario import scenario_base
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase):
|
|||||||
resp = set()
|
resp = set()
|
||||||
for count in range(10):
|
for count in range(10):
|
||||||
time.sleep(1)
|
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)
|
self.assertEqual(expected_resp, resp)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user