summaryrefslogtreecommitdiff
path: root/cloudinit/net/network_state.py
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/network_state.py
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/network_state.py')
-rw-r--r--cloudinit/net/network_state.py4
1 files changed, 4 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', [])