yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #66358
[Bug 1708255] [NEW] empty or invalid network config dictionaries are not handled well
Public bug reported:
Empty or invalid network configurations are not handled gracefully:
network:
version: 1
config: []
network:
foo: 27
wark: True
These result in errors during rendering like this:
File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 570, in render_network_state
network_state).items():
File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 541, in _render_sysconfig
for iface in network_state.iter_interfaces():
AttributeError: 'NoneType' object has no attribute 'iter_interfaces'
r.render_network_state(network_state=ns, target=args.directory)
File "/home/rharper/work/git/cloud-init/cloudinit/net/netplan.py", line 218, in render_network_state
content = self._render_content(network_state)
File "/home/rharper/work/git/cloud-init/cloudinit/net/netplan.py", line 257, in _render_content
interfaces = network_state._network_state.get('interfaces', [])
AttributeError: 'NoneType' object has no attribute '_network_state'
It appears that cloudinit.net.network_state.parse_* and the NetworkStateInterpretor does not do enough validation.
In general we should decide how to handle these two types of
configurations (empty and invalid) and allow cloud-init to fail
gracefully, for example, cloud-init could use fallback_network config in
the case of an invalid supplied network configuration.
** 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/1708255
Title:
empty or invalid network config dictionaries are not handled well
Status in cloud-init:
New
Bug description:
Empty or invalid network configurations are not handled gracefully:
network:
version: 1
config: []
network:
foo: 27
wark: True
These result in errors during rendering like this:
File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 570, in render_network_state
network_state).items():
File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 541, in _render_sysconfig
for iface in network_state.iter_interfaces():
AttributeError: 'NoneType' object has no attribute 'iter_interfaces'
r.render_network_state(network_state=ns, target=args.directory)
File "/home/rharper/work/git/cloud-init/cloudinit/net/netplan.py", line 218, in render_network_state
content = self._render_content(network_state)
File "/home/rharper/work/git/cloud-init/cloudinit/net/netplan.py", line 257, in _render_content
interfaces = network_state._network_state.get('interfaces', [])
AttributeError: 'NoneType' object has no attribute '_network_state'
It appears that cloudinit.net.network_state.parse_* and the NetworkStateInterpretor does not do enough validation.
In general we should decide how to handle these two types of
configurations (empty and invalid) and allow cloud-init to fail
gracefully, for example, cloud-init could use fallback_network config
in the case of an invalid supplied network configuration.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1708255/+subscriptions
Follow ups