summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2022-05-03 18:49:46 +0300
committerzsdc <taras@vyos.io>2022-05-03 18:49:46 +0300
commit244f2117df83590b06e5a1fc747fef3343562570 (patch)
treed9bce514a076bdbec0df0a3e93908b765c065491
parent45c1d42e15f4a5fe5e176e1516b2da9d21e7837a (diff)
downloadvyos-cloud-init-244f2117df83590b06e5a1fc747fef3343562570.tar.gz
vyos-cloud-init-244f2117df83590b06e5a1fc747fef3343562570.zip
T4407: Applied workaround for network-config v2
Network-config v2 is broken is upstream. See the bug report for details: https://bugs.launchpad.net/cloud-init/+bug/1906187 This workaround allows us to use it again in our module.
-rw-r--r--cloudinit/config/cc_vyos.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py
index a7f75316..408a2ea9 100644
--- a/cloudinit/config/cc_vyos.py
+++ b/cloudinit/config/cc_vyos.py
@@ -502,6 +502,12 @@ def handle(name, cfg, cloud, log, _args):
else:
init_stage = Init()
(netcfg, netcfg_src) = init_stage._find_networking_config()
+ # Depending on Network-config version (and maybe something else)
+ # Cloud-init may provide output here in different formats. That
+ # is why we need to add this additional validation and conversion
+ # to what we expect to see in the end. Most likely, the reason is
+ # in: https://bugs.launchpad.net/cloud-init/+bug/1906187
+ netcfg = netcfg.get('network', netcfg)
logger.debug("Network-config: {}".format(netcfg))
logger.debug("Network-config source: {}".format(netcfg_src))
# Hostname with FQDN (if exist)