Python3 code compatibility: Stage2.2 - API changes
six library usage is enabled for non transparent compatible code blueprint fuel-qa-python3-compatibility Change-Id: I2a636c72454809e59545ec20c3cb52124fd9753a
This commit is contained in:
parent
a3775ffb6d
commit
79de91cdc0
|
@ -19,7 +19,6 @@ import json
|
|||
import os
|
||||
import re
|
||||
from time import sleep
|
||||
import urllib2
|
||||
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers.helpers import _wait
|
||||
|
@ -28,6 +27,10 @@ from netaddr import IPAddress
|
|||
from netaddr import IPNetwork
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_true
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
from six.moves.urllib.error import URLError
|
||||
# pylint: enable=import-error
|
||||
import yaml
|
||||
|
||||
from fuelweb_test import logger
|
||||
|
@ -241,7 +244,7 @@ def enable_feature_group(env, group):
|
|||
try:
|
||||
return (group in
|
||||
env.fuel_web.client.get_api_version()["feature_groups"])
|
||||
except (urllib2.HTTPError, urllib2.URLError):
|
||||
except (HTTPError, URLError):
|
||||
return False
|
||||
|
||||
wait(check_api_group_enabled, interval=10, timeout=60 * 20)
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from urlparse import urlparse
|
||||
|
||||
from cinderclient import client as cinderclient
|
||||
from glanceclient.v1 import Client as GlanceClient
|
||||
|
@ -29,6 +28,9 @@ import six
|
|||
# pylint: disable=redefined-builtin
|
||||
from six.moves import xrange
|
||||
# pylint: enable=redefined-builtin
|
||||
# pylint: disable=import-error
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import logwrap
|
||||
|
@ -44,7 +46,7 @@ class Common(object):
|
|||
self.controller_ip = controller_ip
|
||||
|
||||
def make_endpoint(endpoint):
|
||||
parse = urlparse(endpoint)
|
||||
parse = urllib.parse.urlparse(endpoint)
|
||||
return parse._replace(
|
||||
netloc='{}:{}'.format(
|
||||
self.controller_ip, parse.port)).geturl()
|
||||
|
|
|
@ -20,12 +20,14 @@ from subprocess import call
|
|||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from urlparse import urlparse
|
||||
|
||||
from proboscis import SkipTest
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_true
|
||||
import requests
|
||||
# pylint: disable=import-error
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
|
@ -196,7 +198,7 @@ def update_rpm_packages(func):
|
|||
|
||||
if settings.UPDATE_FUEL_MIRROR:
|
||||
for url in settings.UPDATE_FUEL_MIRROR:
|
||||
repo_url = urlparse(url)
|
||||
repo_url = urllib.parse.urlparse(url)
|
||||
cut_dirs = len(repo_url.path.strip('/').split('/'))
|
||||
download_cmd = ('wget --recursive --no-parent'
|
||||
' --no-verbose --reject "index'
|
||||
|
|
|
@ -14,15 +14,20 @@
|
|||
|
||||
import json
|
||||
import traceback
|
||||
import urllib2
|
||||
|
||||
from keystoneclient.v2_0 import Client as KeystoneClient
|
||||
from keystoneclient import exceptions
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib import request
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test import logger
|
||||
|
||||
|
||||
class HTTPClient(object):
|
||||
"""HTTPClient.""" # TODO documentation
|
||||
# TODO: Rewrite using requests library?
|
||||
|
||||
def __init__(self, url, keystone_url, credentials, **kwargs):
|
||||
logger.info('Initiate HTTPClient with url %s', url)
|
||||
|
@ -30,7 +35,7 @@ class HTTPClient(object):
|
|||
self.keystone_url = keystone_url
|
||||
self.creds = dict(credentials, **kwargs)
|
||||
self.keystone = None
|
||||
self.opener = urllib2.build_opener(urllib2.HTTPHandler)
|
||||
self.opener = request.build_opener(request.HTTPHandler)
|
||||
|
||||
def authenticate(self):
|
||||
try:
|
||||
|
@ -64,33 +69,33 @@ class HTTPClient(object):
|
|||
return None
|
||||
|
||||
def get(self, endpoint):
|
||||
req = urllib2.Request(self.url + endpoint)
|
||||
req = request.Request(self.url + endpoint)
|
||||
return self._open(req)
|
||||
|
||||
def post(self, endpoint, data=None, content_type="application/json"):
|
||||
if not data:
|
||||
data = {}
|
||||
req = urllib2.Request(self.url + endpoint, data=json.dumps(data))
|
||||
req = request.Request(self.url + endpoint, data=json.dumps(data))
|
||||
req.add_header('Content-Type', content_type)
|
||||
return self._open(req)
|
||||
|
||||
def put(self, endpoint, data=None, content_type="application/json"):
|
||||
if not data:
|
||||
data = {}
|
||||
req = urllib2.Request(self.url + endpoint, data=json.dumps(data))
|
||||
req = request.Request(self.url + endpoint, data=json.dumps(data))
|
||||
req.add_header('Content-Type', content_type)
|
||||
req.get_method = lambda: 'PUT'
|
||||
return self._open(req)
|
||||
|
||||
def delete(self, endpoint):
|
||||
req = urllib2.Request(self.url + endpoint)
|
||||
req = request.Request(self.url + endpoint)
|
||||
req.get_method = lambda: 'DELETE'
|
||||
return self._open(req)
|
||||
|
||||
def _open(self, req):
|
||||
try:
|
||||
return self._get_response(req)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
if e.code == 401:
|
||||
logger.warning('Authorization failure: {0}'.format(e.read()))
|
||||
self.authenticate()
|
||||
|
@ -121,10 +126,10 @@ class HTTPClientZabbix(object):
|
|||
|
||||
def __init__(self, url):
|
||||
self.url = url
|
||||
self.opener = urllib2.build_opener(urllib2.HTTPHandler)
|
||||
self.opener = request.build_opener(request.HTTPHandler)
|
||||
|
||||
def get(self, endpoint=None, cookie=None):
|
||||
req = urllib2.Request(self.url + endpoint)
|
||||
req = request.Request(self.url + endpoint)
|
||||
if cookie:
|
||||
req.add_header('cookie', cookie)
|
||||
return self.opener.open(req)
|
||||
|
@ -133,7 +138,7 @@ class HTTPClientZabbix(object):
|
|||
cookie=None):
|
||||
if not data:
|
||||
data = {}
|
||||
req = urllib2.Request(self.url + endpoint, data=json.dumps(data))
|
||||
req = request.Request(self.url + endpoint, data=json.dumps(data))
|
||||
req.add_header('Content-Type', content_type)
|
||||
if cookie:
|
||||
req.add_header('cookie', cookie)
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import json
|
||||
import os
|
||||
import urlparse
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
from proboscis import asserts
|
||||
import requests
|
||||
# pylint: disable=import-error
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test.helpers.decorators import token
|
||||
|
@ -41,7 +43,7 @@ class NessusClient(object):
|
|||
def request(self, method, url, body=None, **kwargs):
|
||||
headers = {'X-Cookie': 'token={0}'.format(self.nessus_auth_token),
|
||||
'Content-Type': 'application/json'}
|
||||
url = urlparse.urljoin(self.nessus_base_url, url)
|
||||
url = urllib.parse.urljoin(self.nessus_base_url, url)
|
||||
|
||||
response = requests.request(
|
||||
method, url, data=body, headers=headers,
|
||||
|
|
|
@ -17,8 +17,6 @@ import re
|
|||
import sys
|
||||
import traceback
|
||||
import zlib
|
||||
from urllib2 import urlopen
|
||||
from urlparse import urlparse
|
||||
from xml.dom.minidom import parseString
|
||||
|
||||
from proboscis import register
|
||||
|
@ -27,6 +25,10 @@ from proboscis.asserts import assert_equal
|
|||
from proboscis.asserts import assert_is_not_none
|
||||
from proboscis.asserts import assert_not_equal
|
||||
from proboscis.asserts import assert_true
|
||||
# pylint: disable=import-error,wrong-import-order
|
||||
from six.moves.urllib.request import urlopen
|
||||
from six.moves.urllib.parse import urlparse
|
||||
# pylint: enable=import-error,wrong-import-order
|
||||
import yaml
|
||||
|
||||
from fuelweb_test import logger
|
||||
|
|
|
@ -15,11 +15,15 @@
|
|||
import traceback
|
||||
import os
|
||||
import re
|
||||
import urllib2
|
||||
from xml.etree import ElementTree
|
||||
import zlib
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.request import urlopen
|
||||
from six.moves.urllib.error import HTTPError
|
||||
from six.moves.urllib.error import URLError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test import settings
|
||||
|
@ -127,16 +131,16 @@ class CustomRepo(object):
|
|||
logger.info("Retrieving additional packages from the custom mirror:"
|
||||
" {0}".format(url))
|
||||
try:
|
||||
pkgs_release = urllib2.urlopen(url).read()
|
||||
except (urllib2.HTTPError, urllib2.URLError):
|
||||
pkgs_release = urlopen(url).read()
|
||||
except (HTTPError, URLError):
|
||||
logger.error(traceback.format_exc())
|
||||
url_gz = '{0}.gz'.format(url)
|
||||
logger.info(
|
||||
"Retrieving additional packages from the custom mirror:"
|
||||
" {0}".format(url_gz))
|
||||
try:
|
||||
pkgs_release_gz = urllib2.urlopen(url_gz).read()
|
||||
except (urllib2.HTTPError, urllib2.URLError):
|
||||
pkgs_release_gz = urlopen(url_gz).read()
|
||||
except (HTTPError, URLError):
|
||||
logger.error(traceback.format_exc())
|
||||
raise
|
||||
try:
|
||||
|
@ -165,8 +169,8 @@ class CustomRepo(object):
|
|||
" {0}".format(self.custom_pkgs_mirror))
|
||||
url = "{0}/repodata/repomd.xml".format(self.custom_pkgs_mirror)
|
||||
try:
|
||||
repomd_data = urllib2.urlopen(url).read()
|
||||
except (urllib2.HTTPError, urllib2.URLError):
|
||||
repomd_data = urlopen(url).read()
|
||||
except (HTTPError, URLError):
|
||||
logger.error(traceback.format_exc())
|
||||
raise
|
||||
# Remove namespace attribute before parsing XML
|
||||
|
@ -183,8 +187,8 @@ class CustomRepo(object):
|
|||
.format(url, lists_location, traceback.format_exc()))
|
||||
url = "{0}/{1}".format(self.custom_pkgs_mirror, lists_location)
|
||||
try:
|
||||
lists_data = urllib2.urlopen(url).read()
|
||||
except (urllib2.HTTPError, urllib2.URLError):
|
||||
lists_data = urlopen(url).read()
|
||||
except (HTTPError, URLError):
|
||||
logger.error(traceback.format_exc())
|
||||
raise
|
||||
if '.xml.gz' in lists_location:
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
from __future__ import division
|
||||
|
||||
import ConfigParser
|
||||
# pylint: disable=no-name-in-module
|
||||
from distutils import version
|
||||
# pylint: enable=no-name-in-module
|
||||
|
@ -31,6 +30,9 @@ import netaddr
|
|||
from proboscis import asserts
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis.asserts import assert_equal
|
||||
# pylint: disable=import-error
|
||||
from six.moves import configparser
|
||||
# pylint: enable=import-error
|
||||
# pylint: disable=redefined-builtin
|
||||
from six.moves import xrange
|
||||
# pylint: enable=redefined-builtin
|
||||
|
@ -745,7 +747,7 @@ def get_ini_config(data):
|
|||
:param data: a file object
|
||||
:return: a ConfigParser object
|
||||
"""
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser()
|
||||
config.readfp(data)
|
||||
return config
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ from __future__ import division
|
|||
import re
|
||||
import time
|
||||
import traceback
|
||||
from urllib2 import HTTPError
|
||||
|
||||
from devops.error import DevopsCalledProcessError
|
||||
from devops.error import TimeoutError
|
||||
|
@ -31,6 +30,9 @@ from proboscis.asserts import assert_is_not_none
|
|||
from proboscis.asserts import assert_not_equal
|
||||
from proboscis.asserts import assert_raises
|
||||
from proboscis.asserts import assert_true
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
import yaml
|
||||
|
||||
from fuelweb_test import logger
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
|
||||
import json
|
||||
import re
|
||||
import urllib2
|
||||
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib import request
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.testrail.settings import JENKINS
|
||||
from fuelweb_test.testrail.settings import logger
|
||||
|
@ -25,8 +28,8 @@ def get_jobs_for_view(view):
|
|||
"""
|
||||
view_url = "/".join([JENKINS["url"], 'view', view, 'api/json'])
|
||||
logger.debug("Request view data from {}".format(view_url))
|
||||
req = urllib2.Request(view_url)
|
||||
opener = urllib2.build_opener(urllib2.HTTPHandler)
|
||||
req = request.Request(view_url)
|
||||
opener = request.build_opener(request.HTTPHandler)
|
||||
s = opener.open(req).read()
|
||||
opener.close()
|
||||
view_data = json.loads(s)
|
||||
|
@ -39,8 +42,8 @@ def get_downstream_builds_from_html(url):
|
|||
"""
|
||||
url = "/".join([url, 'downstreambuildview/'])
|
||||
logger.debug("Request downstream builds data from {}".format(url))
|
||||
req = urllib2.Request(url)
|
||||
opener = urllib2.build_opener(urllib2.HTTPHandler)
|
||||
req = request.Request(url)
|
||||
opener = request.build_opener(request.HTTPHandler)
|
||||
s = opener.open(req).read()
|
||||
opener.close()
|
||||
jobs = []
|
||||
|
@ -66,8 +69,8 @@ def get_build_artifact(url, artifact):
|
|||
"""
|
||||
url = "/".join([url, 'artifact', artifact])
|
||||
logger.debug("Request artifact content from {}".format(url))
|
||||
req = urllib2.Request(url)
|
||||
opener = urllib2.build_opener(urllib2.HTTPHandler)
|
||||
req = request.Request(url)
|
||||
opener = request.build_opener(request.HTTPHandler)
|
||||
s = opener.open(req).read()
|
||||
opener.close()
|
||||
return s
|
||||
|
@ -99,13 +102,13 @@ class Build(object):
|
|||
job_url = "/".join([JENKINS["url"], 'job', self.name,
|
||||
'api/json?depth={depth}'.format(depth=depth)])
|
||||
logger.debug("Request job info from {}".format(job_url))
|
||||
return json.load(urllib2.urlopen(job_url))
|
||||
return json.load(request.urlopen(job_url))
|
||||
|
||||
def get_job_console(self):
|
||||
job_url = "/".join([JENKINS["url"], 'job', self.name,
|
||||
str(self.number), 'consoleText'])
|
||||
logger.debug("Request job console from {}".format(job_url))
|
||||
return urllib2.urlopen(job_url)
|
||||
return request.urlopen(job_url)
|
||||
|
||||
def get_build_data(self, depth=1):
|
||||
build_url = "/".join([JENKINS["url"], 'job',
|
||||
|
@ -113,7 +116,7 @@ class Build(object):
|
|||
str(self.number),
|
||||
'api/json?depth={depth}'.format(depth=depth)])
|
||||
logger.debug("Request build data from {}".format(build_url))
|
||||
return json.load(urllib2.urlopen(build_url))
|
||||
return json.load(request.urlopen(build_url))
|
||||
|
||||
@staticmethod
|
||||
def get_test_data(url, result_path=None):
|
||||
|
@ -124,7 +127,7 @@ class Build(object):
|
|||
test_url = "/".join([url.rstrip("/"), 'testReport', 'api/json'])
|
||||
|
||||
logger.debug("Request test data from {}".format(test_url))
|
||||
response = urllib2.urlopen(test_url)
|
||||
response = request.urlopen(test_url)
|
||||
return json.load(response)
|
||||
|
||||
def test_data(self, result_path=None):
|
||||
|
|
|
@ -15,10 +15,12 @@
|
|||
# under the License.
|
||||
|
||||
import json
|
||||
import urllib2
|
||||
|
||||
from logging import DEBUG
|
||||
from optparse import OptionParser
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.request import urlopen
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.testrail.builds import Build
|
||||
from fuelweb_test.testrail.report import get_tests_results
|
||||
|
@ -41,7 +43,7 @@ def find_run_by_name(test_plan, run_name):
|
|||
def get_job_info(url):
|
||||
job_url = "/".join([url, 'api/json'])
|
||||
logger.debug("Request job info from %s", job_url)
|
||||
return json.load(urllib2.urlopen(job_url))
|
||||
return json.load(urlopen(job_url))
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -15,9 +15,12 @@
|
|||
# under the License.
|
||||
|
||||
import optparse
|
||||
import urlparse
|
||||
from xml.etree import ElementTree
|
||||
|
||||
# pylint: disable=import-error
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.testrail import report
|
||||
from fuelweb_test.testrail.settings import JENKINS
|
||||
from fuelweb_test.testrail.settings import logger
|
||||
|
@ -220,7 +223,7 @@ def main():
|
|||
if not test_plan:
|
||||
LOG.info('The test plan not found. Creating one...')
|
||||
url = '/job/{0}.all/{1}'.format(milestone['name'], options.iso_number)
|
||||
description = urlparse.urljoin(JENKINS['url'], url)
|
||||
description = urllib.parse.urljoin(JENKINS['url'], url)
|
||||
test_plan = client.add_plan(test_plan_name,
|
||||
description=description,
|
||||
milestone_id=milestone['id'],
|
||||
|
|
|
@ -26,7 +26,12 @@
|
|||
import base64
|
||||
import json
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.request import urlopen
|
||||
from six.moves.urllib.request import Request
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.testrail.settings import logger
|
||||
|
||||
|
@ -40,7 +45,7 @@ def request_retry(codes):
|
|||
while True:
|
||||
try:
|
||||
response = func(*args, **kwargs)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
if e.code in codes:
|
||||
if iter_number < codes[e.code]:
|
||||
wait = 5
|
||||
|
@ -102,10 +107,10 @@ class APIClient(object):
|
|||
|
||||
@request_retry(codes=retry_codes)
|
||||
def __get_response(_request):
|
||||
return urllib2.urlopen(_request).read()
|
||||
return urlopen(_request).read()
|
||||
|
||||
url = self.__url + uri
|
||||
request = urllib2.Request(url)
|
||||
request = Request(url)
|
||||
if method == 'POST':
|
||||
request.add_data(json.dumps(data))
|
||||
auth = base64.encodestring(
|
||||
|
@ -116,7 +121,7 @@ class APIClient(object):
|
|||
e = None
|
||||
try:
|
||||
response = __get_response(request)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
response = e.read()
|
||||
|
||||
if response:
|
||||
|
|
|
@ -11,12 +11,14 @@
|
|||
# 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 ConfigParser
|
||||
import cStringIO
|
||||
import os
|
||||
|
||||
from proboscis import asserts
|
||||
from proboscis import test
|
||||
# pylint: disable=import-error
|
||||
from six.moves import configparser
|
||||
from six.moves import cStringIO
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers import utils
|
||||
from fuelweb_test.helpers.checkers import check_plugin_path_env
|
||||
|
@ -41,8 +43,8 @@ class EMCPlugin(TestBasic):
|
|||
def check_emc_cinder_config(cls, ip, path):
|
||||
command = 'cat {0}'.format(path)
|
||||
conf_data = SSHManager().execute_on_remote(ip, command)['stdout_str']
|
||||
conf_data = cStringIO.StringIO(conf_data)
|
||||
cinder_conf = ConfigParser.ConfigParser()
|
||||
conf_data = cStringIO(conf_data)
|
||||
cinder_conf = configparser.ConfigParser()
|
||||
cinder_conf.readfp(conf_data)
|
||||
|
||||
asserts.assert_equal(
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import os
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
import bs4
|
||||
from devops.helpers.helpers import wait
|
||||
|
@ -22,6 +20,9 @@ from proboscis.asserts import assert_not_equal
|
|||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
import requests
|
||||
# pylint: disable=import-error
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.checkers import check_plugin_path_env
|
||||
from fuelweb_test.helpers import utils
|
||||
|
@ -40,19 +41,20 @@ class ZabbixWeb(object):
|
|||
self.verify = verify
|
||||
|
||||
def login(self):
|
||||
login_params = urllib.urlencode({'request': '',
|
||||
'name': self.username,
|
||||
'password': self.password,
|
||||
'autologin': 1,
|
||||
'enter': 'Sign in'})
|
||||
url = urlparse.urljoin(self.base_url, '?{0}'.format(login_params))
|
||||
login_params = urllib.parse.urlencode(
|
||||
{'request': '',
|
||||
'name': self.username,
|
||||
'password': self.password,
|
||||
'autologin': 1,
|
||||
'enter': 'Sign in'})
|
||||
url = urllib.parse.urljoin(self.base_url, '?{0}'.format(login_params))
|
||||
response = self.session.post(url, verify=self.verify)
|
||||
|
||||
assert_equal(response.status_code, 200,
|
||||
"Login to Zabbix failed: {0}".format(response.content))
|
||||
|
||||
def get_trigger_statuses(self):
|
||||
url = urlparse.urljoin(self.base_url, 'tr_status.php')
|
||||
url = urllib.parse.urljoin(self.base_url, 'tr_status.php')
|
||||
response = self.session.get(url, verify=self.verify)
|
||||
|
||||
assert_equal(response.status_code, 200,
|
||||
|
@ -62,7 +64,7 @@ class ZabbixWeb(object):
|
|||
return response.content
|
||||
|
||||
def get_screens(self):
|
||||
url = urlparse.urljoin(self.base_url, 'screens.php')
|
||||
url = urllib.parse.urljoin(self.base_url, 'screens.php')
|
||||
response = self.session.get(url, verify=self.verify)
|
||||
|
||||
assert_equal(response.status_code, 200,
|
||||
|
|
|
@ -17,14 +17,16 @@ from __future__ import division
|
|||
import datetime
|
||||
import random
|
||||
import re
|
||||
import urllib2
|
||||
import xmlrpclib
|
||||
|
||||
from devops.helpers.helpers import http
|
||||
from devops.helpers.helpers import wait
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.request import urlopen
|
||||
from six.moves.xmlrpc_client import ServerProxy
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test import logger
|
||||
|
@ -58,7 +60,7 @@ class TestAdminNode(TestBasic):
|
|||
waited_code=501),
|
||||
timeout=60
|
||||
)
|
||||
server = xmlrpclib.Server(
|
||||
server = ServerProxy(
|
||||
'http://%s/cobbler_api' % self.env.get_admin_node_ip())
|
||||
|
||||
config = self.env.admin_actions.get_fuel_settings()
|
||||
|
@ -558,7 +560,7 @@ class GPGSigningCheck(TestBasic):
|
|||
)
|
||||
|
||||
self.show_step(6)
|
||||
response = urllib2.urlopen(
|
||||
response = urlopen(
|
||||
'{}/os/x86_64/Packages/'.format(settings.CENTOS_REPO_PATH)
|
||||
)
|
||||
source = response.read()
|
||||
|
|
|
@ -13,11 +13,13 @@
|
|||
# under the License.
|
||||
|
||||
from copy import deepcopy
|
||||
from urllib2 import HTTPError
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_raises
|
||||
from proboscis import test
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
|
||||
import time
|
||||
import json
|
||||
from urlparse import urlparse
|
||||
from proboscis.asserts import assert_equal
|
||||
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers.helpers import wait
|
||||
# pylint: disable=import-error
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.ssl import change_cluster_ssl_config
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
from fuelweb_test import logwrap
|
||||
|
@ -288,7 +291,7 @@ class CommandLine(TestBasic):
|
|||
jsonify=True)['stdout_json']
|
||||
for endpoint in endpoint_list:
|
||||
if endpoint['Interface'] == 'public':
|
||||
url = urlparse(endpoint['URL'])
|
||||
url = urllib.parse.urlparse(endpoint['URL'])
|
||||
endpoint_info = {'service_name': endpoint['Service Name'],
|
||||
'protocol': url.scheme,
|
||||
'domain': url.hostname}
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib2
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import fail
|
||||
from proboscis import test
|
||||
from proboscis import SkipTest
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.tests import base_test_case
|
||||
|
@ -138,7 +139,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
}
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(1234567, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(404, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
@ -172,7 +173,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(cluster_id, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
@ -203,7 +204,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(cluster_id, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
@ -230,7 +231,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(cluster_id, None)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
@ -263,7 +264,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(cluster_id, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(404, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
@ -296,7 +297,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(cluster_id, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
@ -334,7 +335,7 @@ class TestCloneEnv(base_test_case.TestBasic):
|
|||
self.fuel_web.client.clone_environment(cluster_id, data)
|
||||
try:
|
||||
self.fuel_web.client.clone_environment(cluster_id, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise needed error")
|
||||
|
|
|
@ -13,13 +13,14 @@
|
|||
# under the License.
|
||||
from random import randrange
|
||||
from re import match
|
||||
from urllib2 import HTTPError
|
||||
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_raises
|
||||
from proboscis.asserts import assert_true
|
||||
from proboscis import test
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.checkers import check_ping
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib2
|
||||
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import fail
|
||||
from proboscis import test
|
||||
from proboscis import SkipTest
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
|
||||
from fuelweb_test.tests import base_test_case
|
||||
|
@ -137,7 +139,7 @@ class TestReassignNode(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.reassign_node(123456, data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(404, e.code)
|
||||
else:
|
||||
fail("Doesn't rise HTTP 404 error"
|
||||
|
@ -180,7 +182,7 @@ class TestReassignNode(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.reassign_node(cloned_cluster["id"], None)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise HTTP 400 error on request"
|
||||
|
@ -224,7 +226,7 @@ class TestReassignNode(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.reassign_node(cloned_cluster["id"], data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(400, e.code)
|
||||
else:
|
||||
fail("Doesn't raise HTTP 400 error on request"
|
||||
|
@ -268,7 +270,7 @@ class TestReassignNode(base_test_case.TestBasic):
|
|||
|
||||
try:
|
||||
self.fuel_web.client.reassign_node(cloned_cluster["id"], data)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
assert_equal(404, e.code)
|
||||
else:
|
||||
fail("Doesn't raise HTTP 404 error on request"
|
||||
|
|
|
@ -15,12 +15,14 @@
|
|||
import random
|
||||
import time
|
||||
import traceback
|
||||
from urllib2 import HTTPError
|
||||
|
||||
from devops.helpers import helpers
|
||||
import netaddr
|
||||
from proboscis import asserts
|
||||
from proboscis import test
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers import os_actions
|
||||
|
|
|
@ -1,8 +1,23 @@
|
|||
import httplib
|
||||
from urlparse import urlparse
|
||||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_equal
|
||||
# pylint: disable=import-error
|
||||
from six.moves import http_client
|
||||
from six.moves import urllib
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
|
@ -31,7 +46,7 @@ class SSL_Tests(TestBasic):
|
|||
self.env.revert_snapshot("ready")
|
||||
admin_ip = self.ssh_manager.admin_ip
|
||||
self.show_step(2)
|
||||
connection = httplib.HTTPConnection(admin_ip, 8000)
|
||||
connection = http_client.HTTPConnection(admin_ip, 8000)
|
||||
connection.request("GET", "/")
|
||||
response = connection.getresponse()
|
||||
assert_equal(str(response.status), '301',
|
||||
|
@ -86,7 +101,7 @@ class SSL_Tests(TestBasic):
|
|||
action = OpenStackActions(controller_ip=controller_keystone_ip)
|
||||
endpoint_list = action.get_keystone_endpoints()
|
||||
for endpoint in endpoint_list:
|
||||
url = urlparse(endpoint.publicurl)
|
||||
url = urllib.parse.urlparse(endpoint.publicurl)
|
||||
assert_equal(url.scheme, "http",
|
||||
message=(
|
||||
"Endpoint id {0} uses {1} instead http.".format(
|
||||
|
|
|
@ -14,11 +14,13 @@
|
|||
|
||||
import os
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_is_not_none
|
||||
from proboscis.asserts import assert_true
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.request import urlopen
|
||||
# pylint: enable=import-error
|
||||
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers.helpers import wait
|
||||
|
@ -137,8 +139,8 @@ class PatchingTests(TestBasic):
|
|||
|
||||
# Step #5
|
||||
if settings.LATE_ARTIFACTS_JOB_URL:
|
||||
data = urllib2.urlopen(settings.LATE_ARTIFACTS_JOB_URL +
|
||||
"/artifact/artifacts/artifacts.txt")
|
||||
data = urlopen(settings.LATE_ARTIFACTS_JOB_URL +
|
||||
"/artifact/artifacts/artifacts.txt")
|
||||
for package in data:
|
||||
os.system("wget --directory-prefix"
|
||||
" {0} {1}".format(settings.UPDATE_FUEL_PATH,
|
||||
|
@ -313,7 +315,7 @@ class PatchingMasterTests(TestBasic):
|
|||
|
||||
# Step #2
|
||||
if settings.LATE_ARTIFACTS_JOB_URL:
|
||||
data = urllib2.urlopen(
|
||||
data = urlopen(
|
||||
settings.LATE_ARTIFACTS_JOB_URL +
|
||||
"/artifact/artifacts/artifacts.txt")
|
||||
for package in data:
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib2
|
||||
|
||||
from proboscis import asserts
|
||||
from proboscis import test
|
||||
# pylint: disable=import-error
|
||||
from six.moves.urllib.error import HTTPError
|
||||
# pylint: enable=import-error
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
|
@ -32,7 +33,7 @@ class HaScaleGroup1(TestBasic):
|
|||
def expected_fail_stop_deployment(self, cluster_id):
|
||||
try:
|
||||
self.fuel_web.client.stop_deployment(cluster_id)
|
||||
except urllib2.HTTPError as e:
|
||||
except HTTPError as e:
|
||||
asserts.assert_equal(
|
||||
400,
|
||||
e.code,
|
||||
|
|
Loading…
Reference in New Issue