Fix "label empty or too long" error #645

This commit is contained in:
Darko Poljak 2018-03-09 09:58:49 +01:00
parent bfe8b8fa57
commit b0c5bc793d
2 changed files with 11 additions and 1 deletions

View file

@ -333,6 +333,15 @@ class Config(object):
family = 0 family = 0
return family return family
@staticmethod
def resolve_target_addresses(host, family):
try:
return ipaddr.resolve_target_addresses(host, family)
except:
e = sys.exc_info()[1]
raise cdist.Error(("Error resolving target addresses for host '{}'"
": {}").format(host, e))
@classmethod @classmethod
def onehost(cls, host, host_tags, host_base_path, host_dir_name, args, def onehost(cls, host, host_tags, host_base_path, host_dir_name, args,
parallel, configuration, remove_remote_files_dirs=False): parallel, configuration, remove_remote_files_dirs=False):
@ -353,7 +362,7 @@ class Config(object):
family = cls._address_family(args) family = cls._address_family(args)
log.debug("address family: {}".format(family)) log.debug("address family: {}".format(family))
target_host = ipaddr.resolve_target_addresses(host, family) target_host = cls.resolve_target_addresses(host, family)
log.debug("target_host for host \"{}\": {}".format( log.debug("target_host for host \"{}\": {}".format(
host, target_host)) host, target_host))

View file

@ -16,6 +16,7 @@ next:
* New type: __apt_default_release (Matthijs Kooijman) * New type: __apt_default_release (Matthijs Kooijman)
* Type __file: Add pre-exists state (Matthijs Kooijman) * Type __file: Add pre-exists state (Matthijs Kooijman)
* Type __grafana_dashboard: Add support for stretch + ascii (Nico Schottelius) * Type __grafana_dashboard: Add support for stretch + ascii (Nico Schottelius)
* Core: Fix idna (getaddrinfo) unicode tracebak for invalid host name (Darko Poljak)
4.8.0: 2018-02-14 4.8.0: 2018-02-14
* Core: Skip empty lines in parameter files (Darko Poljak) * Core: Skip empty lines in parameter files (Darko Poljak)