forked from ungleich-public/cdist
Write more informative warning messages.
This commit is contained in:
parent
f87d31f423
commit
74652cec13
1 changed files with 8 additions and 7 deletions
|
@ -266,12 +266,10 @@ class Config(object):
|
||||||
host_name = socket.gethostbyaddr(ip_addr)[0]
|
host_name = socket.gethostbyaddr(ip_addr)[0]
|
||||||
log.debug("derived host_name for host \"{}\": {}".format(
|
log.debug("derived host_name for host \"{}\": {}".format(
|
||||||
host, host_name))
|
host, host_name))
|
||||||
except socket.gaierror as e:
|
except (socket.gaierror, socket.herror) as e:
|
||||||
log.warn("host_name: {}".format(e))
|
log.warn("Could not derive host_name for {}"
|
||||||
# in case of error provide empty value
|
", $host_name will be empty. Error is: {}".format(
|
||||||
host_name = ''
|
host, e))
|
||||||
except socket.herror as e:
|
|
||||||
log.warn("host_name: {}".format(e))
|
|
||||||
# in case of error provide empty value
|
# in case of error provide empty value
|
||||||
host_name = ''
|
host_name = ''
|
||||||
|
|
||||||
|
@ -280,9 +278,12 @@ class Config(object):
|
||||||
log.debug("derived host_fqdn for host \"{}\": {}".format(
|
log.debug("derived host_fqdn for host \"{}\": {}".format(
|
||||||
host, host_fqdn))
|
host, host_fqdn))
|
||||||
except socket.herror as e:
|
except socket.herror as e:
|
||||||
log.warn("host_fqdn: {}".format(e))
|
log.warn("Could not derive host_fqdn for {}"
|
||||||
|
", $host_fqdn will be empty. Error is: {}".format(
|
||||||
|
host, e))
|
||||||
# in case of error provide empty value
|
# in case of error provide empty value
|
||||||
host_fqdn = ''
|
host_fqdn = ''
|
||||||
|
|
||||||
target_host = (host, host_name, host_fqdn)
|
target_host = (host, host_name, host_fqdn)
|
||||||
|
|
||||||
local = cdist.exec.local.Local(
|
local = cdist.exec.local.Local(
|
||||||
|
|
Loading…
Reference in a new issue