Merge "Fix urllib import issue for Python2/3 compatible code."
This commit is contained in:
commit
ca16b1e58e
|
@ -23,7 +23,7 @@ import socket
|
|||
import httplib2
|
||||
|
||||
import six
|
||||
import urlparse
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
try:
|
||||
import ssl
|
||||
|
@ -36,11 +36,6 @@ try:
|
|||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
# Python 2.5 compat fix
|
||||
if not hasattr(urlparse, 'parse_qsl'):
|
||||
import cgi
|
||||
urlparse.parse_qsl = cgi.parse_qsl
|
||||
|
||||
from cgtsclient import exc as exceptions
|
||||
from neutronclient.common import utils
|
||||
|
||||
|
@ -430,7 +425,7 @@ class HTTPClient(httplib2.Http):
|
|||
|
||||
@staticmethod
|
||||
def get_connection_params(endpoint, **kwargs):
|
||||
parts = urlparse.urlparse(endpoint)
|
||||
parts = urlparse(endpoint)
|
||||
|
||||
_args = (parts.hostname, parts.port, parts.path)
|
||||
_kwargs = {'timeout': (float(kwargs.get('timeout'))
|
||||
|
|
|
@ -14,8 +14,8 @@ from pecan import rest
|
|||
import wsme
|
||||
from wsme import types as wtypes
|
||||
import wsmeext.pecan as wsme_pecan
|
||||
import urlparse
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from sysinv.api.controllers.v1 import address_pool
|
||||
from sysinv.api.controllers.v1 import base
|
||||
from sysinv.api.controllers.v1 import collection
|
||||
|
@ -1079,7 +1079,7 @@ class ServiceParameterController(rest.RestController):
|
|||
section=section,
|
||||
name="hpe3par_api_url")
|
||||
|
||||
url = urlparse.urlparse(api_url.value)
|
||||
url = urlparse(api_url.value)
|
||||
ip = netaddr.IPAddress(url.hostname)
|
||||
pool = service_parameter._get_network_pool_from_ip_address(ip, service_parameter.HPE_DATA_NETWORKS)
|
||||
|
||||
|
@ -1221,7 +1221,7 @@ class ServiceParameterController(rest.RestController):
|
|||
section=constants.SERVICE_PARAM_SECTION_CINDER_HPELEFTHAND,
|
||||
name="hpelefthand_api_url")
|
||||
|
||||
url = urlparse.urlparse(api_url.value)
|
||||
url = urlparse(api_url.value)
|
||||
ip = netaddr.IPAddress(url.hostname)
|
||||
|
||||
pool = service_parameter._get_network_pool_from_ip_address(ip, service_parameter.HPE_DATA_NETWORKS)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#
|
||||
|
||||
import time
|
||||
import urlparse
|
||||
from six.moves.urllib.parse import urlparse
|
||||
import webob
|
||||
|
||||
from oslo_config import cfg
|
||||
|
@ -256,7 +256,7 @@ class AuditLogging(hooks.PecanHook):
|
|||
domain_name = state.request.headers.get('X-User-Domain-Name')
|
||||
request_id = state.request.context.request_id
|
||||
|
||||
url_path = urlparse.urlparse(state.request.path_qs).path
|
||||
url_path = urlparse(state.request.path_qs).path
|
||||
|
||||
def json_post_data(rest_state):
|
||||
if not hasattr(rest_state.request, 'json'):
|
||||
|
|
|
@ -17,8 +17,8 @@ import re
|
|||
import rpm
|
||||
import six
|
||||
import wsme
|
||||
import urlparse
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from sysinv.common import constants
|
||||
from sysinv.common import exception
|
||||
from sysinv.common.storage_backend_conf import StorageBackendConfig
|
||||
|
@ -107,7 +107,7 @@ def _validate_zero_or_range(name, value, min, max):
|
|||
|
||||
def _validate_ldap_url(name, value):
|
||||
|
||||
url = urlparse.urlparse(value)
|
||||
url = urlparse(value)
|
||||
|
||||
if cutils.is_valid_ip(url.hostname):
|
||||
try:
|
||||
|
@ -194,7 +194,7 @@ def _validate_neutron_service_plugins(name, value):
|
|||
|
||||
|
||||
def _validate_odl_connection_uri(name, value):
|
||||
url = urlparse.urlparse(value)
|
||||
url = urlparse(value)
|
||||
|
||||
if cutils.is_valid_ip(url.hostname):
|
||||
try:
|
||||
|
@ -293,7 +293,7 @@ def _validate_emc_vnx_data_network_type(name, value):
|
|||
|
||||
|
||||
def _validate_hpe_api_url(name, value):
|
||||
url = urlparse.urlparse(value)
|
||||
url = urlparse(value)
|
||||
|
||||
if cutils.is_valid_ip(url.hostname):
|
||||
try:
|
||||
|
|
|
@ -23,8 +23,8 @@ SQLAlchemy models for sysinv data.
|
|||
"""
|
||||
|
||||
import json
|
||||
import urlparse
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from oslo_config import cfg
|
||||
|
||||
from sqlalchemy import Column, ForeignKey, Integer, BigInteger, Boolean
|
||||
|
@ -46,7 +46,7 @@ cfg.CONF.register_opts(sql_opts, 'database')
|
|||
|
||||
|
||||
def table_args():
|
||||
engine_name = urlparse.urlparse(cfg.CONF.database_connection).scheme
|
||||
engine_name = urlparse(cfg.CONF.database_connection).scheme
|
||||
if engine_name == 'mysql':
|
||||
return {'mysql_engine': cfg.CONF.mysql_engine,
|
||||
'mysql_charset': "utf8"}
|
||||
|
|
|
@ -44,7 +44,7 @@ postgres=# create database openstack_citest with owner openstack_citest;
|
|||
import commands
|
||||
from six.moves import configparser
|
||||
import os
|
||||
import urlparse
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
import mock
|
||||
import sqlalchemy
|
||||
|
@ -235,7 +235,7 @@ class BaseMigrationTestCase(test_utils.BaseTestCase):
|
|||
def _reset_databases(self):
|
||||
for key, engine in self.engines.items():
|
||||
conn_string = self.test_databases[key]
|
||||
conn_pieces = urlparse.urlparse(conn_string)
|
||||
conn_pieces = urlparse(conn_string)
|
||||
|
||||
engine.dispose()
|
||||
if conn_string.startswith('sqlite'):
|
||||
|
@ -565,7 +565,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin):
|
|||
connect_string = _get_connect_string("mysql", self.USER, self.PASSWD,
|
||||
self.DATABASE)
|
||||
(user, password, database, host) = \
|
||||
get_db_connection_info(urlparse.urlparse(connect_string))
|
||||
get_db_connection_info(urlparse(connect_string))
|
||||
engine = sqlalchemy.create_engine(connect_string)
|
||||
self.engines[database] = engine
|
||||
self.test_databases[database] = connect_string
|
||||
|
@ -601,7 +601,7 @@ class TestMigrations(BaseMigrationTestCase, WalkVersionsMixin):
|
|||
self.PASSWD, self.DATABASE)
|
||||
engine = sqlalchemy.create_engine(connect_string)
|
||||
(user, password, database, host) = \
|
||||
get_db_connection_info(urlparse.urlparse(connect_string))
|
||||
get_db_connection_info(urlparse(connect_string))
|
||||
self.engines[database] = engine
|
||||
self.test_databases[database] = connect_string
|
||||
|
||||
|
|
Loading…
Reference in New Issue