From 2089f4d8a3c9b0910465ff0a3ae2c0688ac930ff Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Mon, 29 Mar 2021 14:01:57 -0500 Subject: domain-name: T3446: Cloudinit error message when empty domain is passed to filter. --- cloudinit/config/cc_vyos.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py index f9384e8b..06f5d263 100644 --- a/cloudinit/config/cc_vyos.py +++ b/cloudinit/config/cc_vyos.py @@ -427,8 +427,9 @@ def set_config_hostname(config, hostname, fqdn): if fqdn: try: domain_name = fqdn.partition("{}.".format(hostname))[2] - logger.debug("Configuring domain-name to: {}".format(hostname_filter(domain_name))) - config.set(['system', 'domain-name'], value=hostname_filter(domain_name), replace=True) + if domain_name: + logger.debug("Configuring domain-name to: {}".format(hostname_filter(domain_name))) + config.set(['system', 'domain-name'], value=hostname_filter(domain_name), replace=True) except Exception as err: logger.error("Failed to configure domain-name: {}".format(err)) -- cgit v1.2.3