summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2020-04-03 12:58:08 -0500
committerGitHub <noreply@github.com>2020-04-03 11:58:08 -0600
commit09fea85fd1f6fd944f4cdd8b97e283090178ae88 (patch)
treefc52df7d6697473a449b4759c1f66e1da5e9f6a7 /cloudinit/net
parent723e2bc1ad14687a8d6846b9ca73620e4e4090b1 (diff)
downloadvyos-cloud-init-09fea85fd1f6fd944f4cdd8b97e283090178ae88.tar.gz
vyos-cloud-init-09fea85fd1f6fd944f4cdd8b97e283090178ae88.zip
net: ignore 'renderer' key in netplan config (#306)
LP: #1870421
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/network_state.py2
-rw-r--r--cloudinit/net/tests/test_network_state.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 63d6e291..68f648ff 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -312,7 +312,7 @@ class NetworkStateInterpreter(metaclass=CommandHandlerMeta):
def parse_config_v2(self, skip_broken=True):
for command_type, command in self._config.items():
- if command_type == 'version':
+ if command_type in ['version', 'renderer']:
continue
try:
handler = self.command_handlers[command_type]
diff --git a/cloudinit/net/tests/test_network_state.py b/cloudinit/net/tests/test_network_state.py
index 55880852..07d726e2 100644
--- a/cloudinit/net/tests/test_network_state.py
+++ b/cloudinit/net/tests/test_network_state.py
@@ -45,4 +45,14 @@ class TestNetworkStateParseConfig(CiTestCase):
self.assertNotEqual(None, result)
+class TestNetworkStateParseConfigV2(CiTestCase):
+
+ def test_version_2_ignores_renderer_key(self):
+ ncfg = {'version': 2, 'renderer': 'networkd', 'ethernets': {}}
+ nsi = network_state.NetworkStateInterpreter(version=ncfg['version'],
+ config=ncfg)
+ nsi.parse_config(skip_broken=False)
+ self.assertEqual(ncfg, nsi.as_dict()['config'])
+
+
# vi: ts=4 expandtab