[stable/7.0]Add timeout for keystone client in proxy checker

Add 10 seconds timeout for Keystone client initialization
during HTTP proxy check, because otherwise it could hang
forever.
Also check that find_proxy returns IP address before
using it.

Change-Id: I4fabe0f5fee3d2acc3e7e2387ac858b2c56493c7
Closes-bug: #1499415
(cherry picked from commit 0e7bc3d9e0)
This commit is contained in:
Artem Panchenko 2015-09-24 17:59:45 +03:00 committed by tatyana-leontovich
parent 8c906b73a6
commit 1d0fe68fd8
1 changed files with 4 additions and 3 deletions

View File

@ -764,7 +764,8 @@ class NailgunConfig(object):
password=self.identity.admin_password,
tenant_name=self.identity.admin_tenant_name,
auth_url=auth_url,
insecure=False)
insecure=False,
timeout=10)
return ip
except Exception:
LOG.warning('Can not pass authorization '
@ -779,8 +780,8 @@ class NailgunConfig(object):
if not self.compute.online_controllers:
raise exceptions.OfflineControllers()
proxies = [self.find_proxy(ip) for ip in
self.compute.online_controllers]
proxies = [ip for ip in self.compute.online_controllers
if self.find_proxy(ip) is not None]
if not proxies:
raise exceptions.SetProxy()