diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-12-04 08:33:59 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-12-14 07:23:00 +0000 |
commit | 3f29dd2f11e3bb847fce5ac56060758d6076e8e7 (patch) | |
tree | d8fce3daf5820ed65082a2451700e2cc9742c858 /functest/ci/check_deployment.py | |
parent | 3306da5522f2576f2cd8431aac7fd4f3f4b32ca3 (diff) |
Improve the pylint score of functest-core
It also modifies the file list to ensure the rating of ci modules.
Change-Id: Ia1e414be5364cb3da3d54882db428024ed6bd99f
Signed-off-by: Linda Wang <wangwulin@huawei.com>
Diffstat (limited to 'functest/ci/check_deployment.py')
-rw-r--r-- | functest/ci/check_deployment.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/functest/ci/check_deployment.py b/functest/ci/check_deployment.py index 8cc522f6..ffea6beb 100644 --- a/functest/ci/check_deployment.py +++ b/functest/ci/check_deployment.py @@ -19,7 +19,7 @@ import logging import logging.config import os import pkg_resources -from six.moves.urllib.parse import urlparse +from six.moves import urllib import socket from functest.opnfv_tests.openstack.snaps import snaps_utils @@ -36,19 +36,19 @@ LOGGER = logging.getLogger(__name__) def verify_connectivity(endpoint): - """ Returns true if an ip/port is reachable""" + """ Returns true if an hostname/port is reachable""" connection = socket.socket() connection.settimeout(10) - ip = urlparse(endpoint).hostname - port = urlparse(endpoint).port + hostname = urllib.parse.urlparse(endpoint).hostname + port = urllib.parse.urlparse(endpoint).port if not port: - port = 443 if urlparse(endpoint).scheme == "https" else 80 + port = 443 if urllib.parse.urlparse(endpoint).scheme == "https" else 80 try: - connection.connect((ip, port)) - LOGGER.debug('%s:%s is reachable!', ip, port) + connection.connect((hostname, port)) + LOGGER.debug('%s:%s is reachable!', hostname, port) return True except socket.error: - LOGGER.exception('%s:%s is not reachable.', ip, port) + LOGGER.exception('%s:%s is not reachable.', hostname, port) return False @@ -71,7 +71,7 @@ class CheckDeployment(object): def check_auth_endpoint(self): """ Verifies connectivity to the OS_AUTH_URL given in the RC file """ rc_endpoint = self.os_creds.auth_url - if not (verify_connectivity(rc_endpoint)): + if not verify_connectivity(rc_endpoint): raise Exception("OS_AUTH_URL {} is not reachable.". format(rc_endpoint)) LOGGER.info("Connectivity to OS_AUTH_URL %s ...OK", rc_endpoint) @@ -81,7 +81,7 @@ class CheckDeployment(object): public_endpoint = keystone_utils.get_endpoint(self.os_creds, 'identity', interface='public') - if not (verify_connectivity(public_endpoint)): + if not verify_connectivity(public_endpoint): raise Exception("Public endpoint {} is not reachable.". format(public_endpoint)) LOGGER.info("Connectivity to the public endpoint %s ...OK", @@ -92,7 +92,7 @@ class CheckDeployment(object): endpoint = keystone_utils.get_endpoint(self.os_creds, service, interface='public') - if not (verify_connectivity(endpoint)): + if not verify_connectivity(endpoint): raise Exception("{} endpoint {} is not reachable.". format(service, endpoint)) LOGGER.info("Connectivity to endpoint '%s' %s ...OK", @@ -132,7 +132,7 @@ class CheckDeployment(object): """ checks if external network exists """ ext_net = snaps_utils.get_ext_net_name(self.os_creds) if ext_net: - LOGGER.info("External network found: %s" % ext_net) + LOGGER.info("External network found: %s", ext_net) else: raise Exception("ERROR: No external networks in the deployment.") |