diff options
author | Kim Hagen <kim@sentrium.io> | 2021-03-29 14:01:57 -0500 |
---|---|---|
committer | Kim Hagen <kim@sentrium.io> | 2021-03-29 14:01:57 -0500 |
commit | 2f72bee35078604e9059ae5f8ae5c127ee05db4c (patch) | |
tree | 527565b512a078d128c65c87f8d9f729a519e1a0 /cloudinit/config | |
parent | 5b47d9dc1cd80e3dbd0fb21125febab2e99d5f9c (diff) | |
download | vyos-cloud-init-2f72bee35078604e9059ae5f8ae5c127ee05db4c.tar.gz vyos-cloud-init-2f72bee35078604e9059ae5f8ae5c127ee05db4c.zip |
domain-name: T3446: Cloudinit error message when empty domain is passed to filter.
Diffstat (limited to 'cloudinit/config')
-rw-r--r-- | cloudinit/config/cc_vyos.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py index 42b442fc..e632b1fa 100644 --- a/cloudinit/config/cc_vyos.py +++ b/cloudinit/config/cc_vyos.py @@ -441,8 +441,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)) |