Fix getting host_name and host_fqdn.
This commit is contained in:
parent
2fb551131e
commit
680806ce76
1 changed files with 10 additions and 2 deletions
|
@ -243,15 +243,23 @@ class Config(object):
|
|||
# gethostbyaddr returns triple
|
||||
# (hostname, aliaslist, ipaddrlist)
|
||||
host_name = socket.gethostbyaddr(ip_addr)[0]
|
||||
log.debug("derived host_name for host \"{}\": {}".format(
|
||||
host, host_name))
|
||||
except socket.gaierror as e:
|
||||
log.warn("{}".format(e))
|
||||
log.warn("host_name: {}".format(e))
|
||||
# in case of error provide empty value
|
||||
host_name = ''
|
||||
except socket.herror as e:
|
||||
log.warn("host_name: {}".format(e))
|
||||
# in case of error provide empty value
|
||||
host_name = ''
|
||||
|
||||
try:
|
||||
host_fqdn = socket.getfqdn(host)
|
||||
log.debug("derived host_fqdn for host \"{}\": {}".format(
|
||||
host, host_fqdn))
|
||||
except socket.herror as e:
|
||||
log.warn("{}: {}".format(e[0], e[1]))
|
||||
log.warn("host_fqdn: {}".format(e))
|
||||
# in case of error provide empty value
|
||||
host_fqdn = ''
|
||||
target_host = (host, host_name, host_fqdn)
|
||||
|
|
Loading…
Reference in a new issue