Merge "use urlparse from six"
This commit is contained in:
commit
eb39b64398
@ -19,8 +19,8 @@
|
||||
|
||||
import collections
|
||||
import itertools
|
||||
import urlparse
|
||||
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from stevedore import extension
|
||||
|
||||
from ceilometer.openstack.common import context
|
||||
|
@ -17,10 +17,9 @@
|
||||
"""Rest alarm notifier."""
|
||||
|
||||
import eventlet
|
||||
import requests
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from oslo.config import cfg
|
||||
import requests
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.alarm import notifier
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
|
@ -17,10 +17,10 @@
|
||||
# under the License.
|
||||
"""Inspector for collecting data over SNMP"""
|
||||
|
||||
import urlparse
|
||||
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.hardware.inspector import base
|
||||
from pysnmp.entity.rfc3413.oneliner import cmdgen
|
||||
|
||||
|
||||
class SNMPException(Exception):
|
||||
|
@ -19,7 +19,8 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
import urlparse
|
||||
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.openstack.common import timeutils
|
||||
from ceilometer import sample
|
||||
|
@ -16,7 +16,7 @@
|
||||
import abc
|
||||
|
||||
import six
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from stevedore import driver as _driver
|
||||
|
||||
from ceilometer.central import plugin
|
||||
@ -47,13 +47,13 @@ class _Base(plugin.CentralPollster):
|
||||
|
||||
parse_url = network_utils.urlsplit(resource)
|
||||
|
||||
params = url_parse.parse_qs(parse_url.query)
|
||||
parts = url_parse.ParseResult(parse_url.scheme,
|
||||
parse_url.netloc,
|
||||
parse_url.path,
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
params = urlparse.parse_qs(parse_url.query)
|
||||
parts = urlparse.ParseResult(parse_url.scheme,
|
||||
parse_url.netloc,
|
||||
parse_url.path,
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
return parts, params
|
||||
|
||||
@staticmethod
|
||||
|
@ -17,7 +17,7 @@
|
||||
from oslo.config import cfg
|
||||
import requests
|
||||
import six
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
@ -51,7 +51,7 @@ class AnalyticsAPIBaseClient(object):
|
||||
'domain': self.domain}
|
||||
|
||||
req_params = self._get_req_params(data=data)
|
||||
url = url_parse.urljoin(self.endpoint, path)
|
||||
url = urlparse.urljoin(self.endpoint, path)
|
||||
resp = requests.post(url, **req_params)
|
||||
if resp.status_code != 302:
|
||||
raise OpencontrailAPIFailed(
|
||||
@ -71,7 +71,7 @@ class AnalyticsAPIBaseClient(object):
|
||||
req_params = self._get_req_params(data=data,
|
||||
cookies={'connect.sid': self.sid})
|
||||
|
||||
url = url_parse.urljoin(self.endpoint, path)
|
||||
url = urlparse.urljoin(self.endpoint, path)
|
||||
self._log_req(url, req_params)
|
||||
resp = requests.get(url, **req_params)
|
||||
self._log_res(resp)
|
||||
|
@ -14,7 +14,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics import driver
|
||||
from ceilometer.network.statistics.opencontrail import client
|
||||
@ -73,13 +73,13 @@ class OpencontrailDriver(driver.Driver):
|
||||
|
||||
def get_sample_data(self, meter_name, parse_url, params, cache):
|
||||
|
||||
parts = url_parse.ParseResult(params.get('scheme', ['http'])[0],
|
||||
parse_url.netloc,
|
||||
parse_url.path,
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
endpoint = url_parse.urlunparse(parts)
|
||||
parts = urlparse.ParseResult(params.get('scheme', ['http'])[0],
|
||||
parse_url.netloc,
|
||||
parse_url.path,
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
endpoint = urlparse.urlunparse(parts)
|
||||
|
||||
iter = self._get_iter(meter_name)
|
||||
if iter is None:
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import six
|
||||
from six import moves
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics import driver
|
||||
from ceilometer.network.statistics.opendaylight import client
|
||||
@ -187,13 +187,13 @@ class OpenDayLightDriver(driver.Driver):
|
||||
# OpenDaylight REST API has not api to getting meter.
|
||||
return None
|
||||
|
||||
parts = url_parse.ParseResult(params.get('scheme', ['http'])[0],
|
||||
parse_url.netloc,
|
||||
parse_url.path,
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
endpoint = url_parse.urlunparse(parts)
|
||||
parts = urlparse.ParseResult(params.get('scheme', ['http'])[0],
|
||||
parse_url.netloc,
|
||||
parse_url.path,
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
endpoint = urlparse.urlunparse(parts)
|
||||
|
||||
data = self._prepare_cache(endpoint, params, cache)
|
||||
|
||||
|
@ -18,10 +18,10 @@
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from keystoneclient import exceptions
|
||||
from oslo.config import cfg
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from swiftclient import client as swift
|
||||
|
||||
from ceilometer.central import plugin
|
||||
|
@ -17,7 +17,8 @@
|
||||
|
||||
import logging
|
||||
import logging.handlers
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
from ceilometer.openstack.common import log
|
||||
|
@ -20,11 +20,11 @@
|
||||
|
||||
import itertools
|
||||
import operator
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from oslo.config import cfg
|
||||
import oslo.messaging
|
||||
import oslo.messaging._drivers.common
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer import messaging
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
|
@ -17,10 +17,9 @@
|
||||
"""Storage backend management
|
||||
"""
|
||||
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from stevedore import driver
|
||||
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
|
@ -16,10 +16,10 @@ import datetime
|
||||
import hashlib
|
||||
import operator
|
||||
import os
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import time
|
||||
|
||||
import happybase
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.alarm.storage import models as alarm_models
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
|
@ -14,10 +14,10 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
import mock
|
||||
import requests
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.alarm import service
|
||||
from ceilometer.openstack.common import context
|
||||
|
@ -20,11 +20,11 @@
|
||||
"""Base classes for API tests."""
|
||||
import fixtures
|
||||
import os
|
||||
import urlparse
|
||||
import uuid
|
||||
import warnings
|
||||
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
import testscenarios.testcase
|
||||
from testtools import testcase
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics.opencontrail import driver
|
||||
from ceilometer.openstack.common import test
|
||||
@ -37,9 +37,9 @@ class TestOpencontrailDriver(test.BaseTestCase):
|
||||
self.nc_networks.start()
|
||||
|
||||
self.driver = driver.OpencontrailDriver()
|
||||
self.parse_url = url_parse.ParseResult('opencontrail',
|
||||
'127.0.0.1:8143',
|
||||
'/', None, None, None)
|
||||
self.parse_url = urlparse.ParseResult('opencontrail',
|
||||
'127.0.0.1:8143',
|
||||
'/', None, None, None)
|
||||
self.params = {'password': ['admin'],
|
||||
'scheme': ['http'],
|
||||
'username': ['admin'],
|
||||
|
@ -13,10 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import mock
|
||||
|
||||
from requests import auth as req_auth
|
||||
import six
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics.opendaylight import client
|
||||
from ceilometer.openstack.common.gettextutils import _
|
||||
@ -30,16 +29,16 @@ class TestClientHTTPBasicAuth(test.BaseTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestClientHTTPBasicAuth, self).setUp()
|
||||
self.parsed_url = url_parse.urlparse(
|
||||
self.parsed_url = urlparse.urlparse(
|
||||
'http://127.0.0.1:8080/controller/nb/v2?container_name=default&'
|
||||
'container_name=egg&auth=%s&user=admin&password=admin_pass&'
|
||||
'scheme=%s' % (self.auth_way, self.scheme))
|
||||
self.params = url_parse.parse_qs(self.parsed_url.query)
|
||||
self.endpoint = url_parse.urlunparse(
|
||||
url_parse.ParseResult(self.scheme,
|
||||
self.parsed_url.netloc,
|
||||
self.parsed_url.path,
|
||||
None, None, None))
|
||||
self.params = urlparse.parse_qs(self.parsed_url.query)
|
||||
self.endpoint = urlparse.urlunparse(
|
||||
urlparse.ParseResult(self.scheme,
|
||||
self.parsed_url.netloc,
|
||||
self.parsed_url.path,
|
||||
None, None, None))
|
||||
odl_params = {}
|
||||
odl_params['auth'] = self.params.get('auth')[0]
|
||||
odl_params['user'] = self.params.get('user')[0]
|
||||
|
@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import abc
|
||||
import mock
|
||||
|
||||
import mock
|
||||
import six
|
||||
from six import moves
|
||||
from six.moves.urllib import parse as url_parse
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from ceilometer.network.statistics.opendaylight import driver
|
||||
from ceilometer.openstack.common import test
|
||||
@ -58,20 +58,20 @@ class _Base(test.BaseTestCase):
|
||||
def inactive_hosts_data(self):
|
||||
pass
|
||||
|
||||
fake_odl_url = url_parse.ParseResult('opendaylight',
|
||||
'localhost:8080',
|
||||
'controller/nb/v2',
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
fake_odl_url = urlparse.ParseResult('opendaylight',
|
||||
'localhost:8080',
|
||||
'controller/nb/v2',
|
||||
None,
|
||||
None,
|
||||
None)
|
||||
|
||||
fake_params = url_parse.parse_qs('user=admin&password=admin&scheme=http&'
|
||||
'container_name=default&auth=basic')
|
||||
fake_params = urlparse.parse_qs('user=admin&password=admin&scheme=http&'
|
||||
'container_name=default&auth=basic')
|
||||
|
||||
fake_params_multi_container = \
|
||||
url_parse.parse_qs('user=admin&password=admin&scheme=http&'
|
||||
'container_name=first&container_name=second&'
|
||||
'auth=basic')
|
||||
urlparse.parse_qs('user=admin&password=admin&scheme=http&'
|
||||
'container_name=first&container_name=second&'
|
||||
'auth=basic')
|
||||
|
||||
def setUp(self):
|
||||
super(_Base, self).setUp()
|
||||
|
Loading…
Reference in New Issue
Block a user