Error handling during hosts file generation
Cluster deployment currently fails if hostname of service endpoint cannot be resolved. An error like this should not be critical since it could be the result of a temporary DNS issue, etc. The patch will allow deployment to continue. A warning will appear in the logs and in the hosts file of each instance. Change-Id: I8e4d88ec782dec900b39135e49da985bf9d4f39b Closes-Bug: #1616112
This commit is contained in:
parent
cdab2c2bfb
commit
153ea9ad70
|
@ -24,6 +24,7 @@ from sahara import conductor as c
|
|||
from sahara import context
|
||||
from sahara import exceptions as e
|
||||
from sahara.i18n import _LI
|
||||
from sahara.i18n import _LW
|
||||
from sahara.utils.notification import sender
|
||||
from sahara.utils.openstack import base as auth_base
|
||||
|
||||
|
@ -145,7 +146,12 @@ def _etc_hosts_for_services(hosts):
|
|||
except keystone_ex.EndpointNotFound:
|
||||
LOG.debug("Endpoint not found for service: \"%s\"", service)
|
||||
continue
|
||||
hosts += "%s %s\n" % (socket.gethostbyname(hostname), hostname)
|
||||
try:
|
||||
hosts += "%s %s\n" % (socket.gethostbyname(hostname), hostname)
|
||||
except socket.gaierror:
|
||||
LOG.warning(_LW("Failed to resolve hostname of service: \"%s\""),
|
||||
service)
|
||||
hosts += "#Failed to resolve %s during deployment\n" % hostname
|
||||
return hosts
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue