From b0c5bc793d768250af95c8f1e623787a4a74d0c7 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Fri, 9 Mar 2018 09:58:49 +0100 Subject: [PATCH] Fix "label empty or too long" error #645 --- cdist/config.py | 11 ++++++++++- docs/changelog | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cdist/config.py b/cdist/config.py index 38e225a5..74f68a72 100644 --- a/cdist/config.py +++ b/cdist/config.py @@ -333,6 +333,15 @@ class Config(object): family = 0 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 def onehost(cls, host, host_tags, host_base_path, host_dir_name, args, parallel, configuration, remove_remote_files_dirs=False): @@ -353,7 +362,7 @@ class Config(object): family = cls._address_family(args) 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( host, target_host)) diff --git a/docs/changelog b/docs/changelog index 0b5c5f17..3ceae2ec 100644 --- a/docs/changelog +++ b/docs/changelog @@ -16,6 +16,7 @@ next: * New type: __apt_default_release (Matthijs Kooijman) * Type __file: Add pre-exists state (Matthijs Kooijman) * 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 * Core: Skip empty lines in parameter files (Darko Poljak)