yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #82707
[Bug 1879673] [NEW] KeyError on optional parameters on bridge
Public bug reported:
I use NoCloud with network-config-format-v2
and the following network config according to
https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html#bridges
/var/lib/cloud/seed/nocloud-net/network-config:
version: 2
ethernets:
eth0:
match: {name: "eth0"}
eth1:
match: {name: "eth1"}
bridges:
br0:
interfaces: [eth1]
cloud-init init fails with a Python error:
2020-05-20 09:53:24,474 - util.py[WARNING]: failed stage init
failed run of stage init
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 362, in main_init
init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 708, in apply_network_config
return self.distro.apply_network_config(netcfg, bring_up=bring_up)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 180, in apply_network_config
dev_names = self._write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 115, in _write_network_config
return self._supported_write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 95, in _supported_write_network_config
renderer.render_network_config(network_config)
File "/usr/lib/python3/dist-packages/cloudinit/net/renderer.py", line 55, in render_network_config
network_state=parse_net_config_data(network_config),
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 76, in parse_net_config_data
nsi.parse_config(skip_broken=skip_broken)
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 292, in parse_config
self.parse_config_v2(skip_broken=skip_broken)
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 323, in parse_config_v2
handler(self, command)
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 599, in handle_bridges
self._handle_bond_bridge(command, cmd_type='bridge')
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 728, in _handle_bond_bridge
params = item_params['parameters']
KeyError: 'parameters'
It may be fixed by changing:
https://github.com/canonical/cloud-init/blob/master/cloudinit/net/network_state.py#L728
to
params = item_params.get('parameters', {})
as the parameters key is optional.
The workaround is to add an empty
parameters: {}
mapping to your bridge
** Affects: cloud-init
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1879673
Title:
KeyError on optional parameters on bridge
Status in cloud-init:
New
Bug description:
I use NoCloud with network-config-format-v2
and the following network config according to
https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html#bridges
/var/lib/cloud/seed/nocloud-net/network-config:
version: 2
ethernets:
eth0:
match: {name: "eth0"}
eth1:
match: {name: "eth1"}
bridges:
br0:
interfaces: [eth1]
cloud-init init fails with a Python error:
2020-05-20 09:53:24,474 - util.py[WARNING]: failed stage init
failed run of stage init
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 362, in main_init
init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 708, in apply_network_config
return self.distro.apply_network_config(netcfg, bring_up=bring_up)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 180, in apply_network_config
dev_names = self._write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 115, in _write_network_config
return self._supported_write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 95, in _supported_write_network_config
renderer.render_network_config(network_config)
File "/usr/lib/python3/dist-packages/cloudinit/net/renderer.py", line 55, in render_network_config
network_state=parse_net_config_data(network_config),
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 76, in parse_net_config_data
nsi.parse_config(skip_broken=skip_broken)
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 292, in parse_config
self.parse_config_v2(skip_broken=skip_broken)
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 323, in parse_config_v2
handler(self, command)
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 599, in handle_bridges
self._handle_bond_bridge(command, cmd_type='bridge')
File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 728, in _handle_bond_bridge
params = item_params['parameters']
KeyError: 'parameters'
It may be fixed by changing:
https://github.com/canonical/cloud-init/blob/master/cloudinit/net/network_state.py#L728
to
params = item_params.get('parameters', {})
as the parameters key is optional.
The workaround is to add an empty
parameters: {}
mapping to your bridge
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1879673/+subscriptions
Follow ups