summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorAndrew Kutz <101085+akutz@users.noreply.github.com>2021-10-08 12:49:58 -0500
committerGitHub <noreply@github.com>2021-10-08 12:49:58 -0500
commitca0da042e73d1cf078435befa02a6e09d004b62d (patch)
tree8993560d3df037d764d8ae02cc733f97021d75d4 /cloudinit/net
parent1ee2f3c3f96e5639a00aeea87100d7fb3681c76f (diff)
downloadvyos-cloud-init-ca0da042e73d1cf078435befa02a6e09d004b62d.tar.gz
vyos-cloud-init-ca0da042e73d1cf078435befa02a6e09d004b62d.zip
Fix set-name/interface DNS bug (#1058)
This patch addresses an issue caused when the v2 network config directive "set-name" was used in conjunction with interface- specific DNS settings. The patch adds a test to validate the fix. For more information please see bug 1946493 as well as the issue https://github.com/kubernetes-sigs/image-builder/issues/712. LP: #1946493
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/network_state.py4
-rw-r--r--cloudinit/net/tests/test_network_state.py1
2 files changed, 5 insertions, 0 deletions
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 95b064f0..4862bf91 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -710,6 +710,10 @@ class NetworkStateInterpreter(metaclass=CommandHandlerMeta):
def _v2_common(self, cfg):
LOG.debug('v2_common: handling config:\n%s', cfg)
for iface, dev_cfg in cfg.items():
+ if 'set-name' in dev_cfg:
+ set_name_iface = dev_cfg.get('set-name')
+ if set_name_iface:
+ iface = set_name_iface
if 'nameservers' in dev_cfg:
search = dev_cfg.get('nameservers').get('search', [])
dns = dev_cfg.get('nameservers').get('addresses', [])
diff --git a/cloudinit/net/tests/test_network_state.py b/cloudinit/net/tests/test_network_state.py
index 84e8308a..45e99171 100644
--- a/cloudinit/net/tests/test_network_state.py
+++ b/cloudinit/net/tests/test_network_state.py
@@ -52,6 +52,7 @@ network:
eth1:
match:
macaddress: '66:77:88:99:00:11'
+ set-name: "ens92"
nameservers:
search: [foo.local, bar.local]
addresses: [4.4.4.4]