summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-01-27 17:25:05 +0200
committerzsdc <taras@vyos.io>2023-01-27 17:25:05 +0200
commitf1cf5759886bd4ffe6551c4cd09584671918a075 (patch)
tree13f795edb370a04295900709f2a272c41e725d4f
parentd8bc4f5a18864ae324b2963525828fa0270c52b4 (diff)
downloadvyos-cloud-init-f1cf5759886bd4ffe6551c4cd09584671918a075.tar.gz
vyos-cloud-init-f1cf5759886bd4ffe6551c4cd09584671918a075.zip
network-config: T4954: Fixed DNS settings
This commit fixes setting DNS configuration if it was presented as a string instead array of strings.
-rw-r--r--cloudinit/config/cc_vyos.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py
index 408a2ea9..dd95a245 100644
--- a/cloudinit/config/cc_vyos.py
+++ b/cloudinit/config/cc_vyos.py
@@ -323,6 +323,10 @@ def set_config_interfaces_v1(config, iface_config):
# configure nameservers
if iface_config['type'] == 'nameserver':
+ # convert a string to list with a single item if necessary
+ if isinstance(iface_config['address'], str):
+ iface_config['address'] = [iface_config['address']]
+
for item in iface_config['address']:
logger.debug("Configuring DNS nameserver: {}".format(item))
config.set(['system', 'name-server'], value=item, replace=False)