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 authored and Martin Kosek committed 2013-04-24 15:28:57 +02:00
1 parent 63e79a3d86
commit bd89e49ed7
1 file changed
+2
+2
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