← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1708255] Re: Invalid network config dictionaries are not handled well

 

Tracked in Github Issues as https://github.com/canonical/cloud-
init/issues/2969

** Bug watch added: github.com/canonical/cloud-init/issues #2969
   https://github.com/canonical/cloud-init/issues/2969

** Changed in: cloud-init
       Status: Confirmed => Expired

-- 
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:
  Invalid network config dictionaries are not handled well

Status in cloud-init:
  Expired

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



References