diff options
author | Jose Lausuch <jalausuch@suse.com> | 2017-10-03 06:37:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-10-03 06:37:04 +0000 |
commit | f16ba39de51b9e6893002a8ea7be1891c35083a3 (patch) | |
tree | e9597256c6403ebae67a5ac01ab771d26fa24187 | |
parent | 625f8ba769a6f9c897fa4f2dd94054edc7073540 (diff) | |
parent | 3ef5513ea2786a09ccc884b18d03dc1401f0d714 (diff) |
Merge "Fix timeout for socket connection" into stable/euphrates
-rw-r--r-- | functest/ci/check_deployment.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/functest/ci/check_deployment.py b/functest/ci/check_deployment.py index 13bb4c8bc..e593e17b8 100644 --- a/functest/ci/check_deployment.py +++ b/functest/ci/check_deployment.py @@ -20,7 +20,6 @@ import logging.config import os import pkg_resources import socket -import time from urlparse import urlparse from snaps.openstack.utils import glance_utils @@ -34,20 +33,16 @@ __author__ = "Jose Lausuch <jose.lausuch@ericsson.com>" LOGGER = logging.getLogger(__name__) -def verify_connectivity(adress, port, timeout=10): +def verify_connectivity(adress, port): """ Returns true if an ip/port is reachable""" connection = socket.socket() - count = 0 - while count < timeout: - try: - connection.connect((adress, port)) - LOGGER.debug('%s:%s is reachable!', adress, port) - return True - except socket.error: - count += 1 - time.sleep(1) - continue - LOGGER.error('%s:%s is not reachable.', adress, port) + connection.settimeout(10) + try: + connection.connect((adress, port)) + LOGGER.debug('%s:%s is reachable!', adress, port) + return True + except socket.error: + LOGGER.error('%s:%s is not reachable.', adress, port) return False |