diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2020-04-03 12:58:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 11:58:08 -0600 |
commit | 09fea85fd1f6fd944f4cdd8b97e283090178ae88 (patch) | |
tree | fc52df7d6697473a449b4759c1f66e1da5e9f6a7 /cloudinit/net | |
parent | 723e2bc1ad14687a8d6846b9ca73620e4e4090b1 (diff) | |
download | vyos-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.py | 2 | ||||
-rw-r--r-- | cloudinit/net/tests/test_network_state.py | 10 |
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 |