Handle socket.gethostbyaddr() exceptions when verifying hostnames.

Log any socket exceptions raised and let the process continue. This
failure isn't a show-stopper. Other checks past this will catch any
other problems.

This was seen when /etc/hosts and /etc/resolv.conf were both empty.

https://fedorahosted.org/freeipa/ticket/3581
This commit is contained in:
Rob Crittenden 2013-04-22 14:17:03 -04:00 committed by Martin Kosek
parent 63e79a3d86
commit bd89e49ed7

View File

@ -128,6 +128,8 @@ def verify_fqdn(host_name, no_host_dns=False, local_hostname=True):
"Please check /etc/hosts or DNS name resolution" % (host_name, ex_name[0]))
except socket.gaierror:
pass
except socket.error, e:
root_logger.debug('socket.gethostbyaddr() error: %d: %s' % (e.errno, e.strerror))
if no_host_dns:
print "Warning: skipping DNS resolution of host", host_name