cloud-init fails on valid netplan

Bug #1870421 reported by Dimitri John Ledkov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released
Medium
Ryan Harper
Focal
Fix Released
Medium
Ryan Harper

Bug Description

http://paste.ubuntu.com/p/KR7P7ZYvzj/

2020-04-02 20:27:47,323 - stages.py[INFO]: Applying network configuration from system_cfg bringup=False: {'version': 2, 'renderer': 'networkd', 'ethernets': {'ens3': {'match': {'macaddress': '52:54:00:b2:9d:87'}, 'set-name': 'ens3', 'dhcp4': True, 'dhcp-identifier': 'mac', 'critical': True, 'nameservers': {'addresses': ['192.168.122.1']}}, 'all-en': {'match': {'name': 'en*'}, 'dhcp4': True}, 'all-eth': {'match': {'name': 'eth*'}, 'dhcp4': True}}}
2020-04-02 20:27:47,327 - __init__.py[DEBUG]: Selected renderer 'netplan' from priority list: None
2020-04-02 20:27:47,328 - util.py[WARNING]: failed stage init-local
2020-04-02 20:27:47,328 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 318, in parse_config_v2
    handler = self.command_handlers[command_type]
KeyError: 'renderer'

During handling of the above exception, another exception occurred:

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 175, 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 90, 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 320, in parse_config_v2
    raise RuntimeError("No handler found for"
RuntimeError: No handler found for command 'renderer'

renderer is a valid netplan key. https://netplan.io/reference

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

With attached foo.yaml, I can reproduce this with:

$ cloud-init devel net-convert -p ./foo.yaml --kind yaml -O eni -d . -D ubuntu

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/net/network_state.py", line 318, in parse_config_v2
    handler = self.command_handlers[command_type]
KeyError: 'renderer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/cloud-init", line 11, in <module>
    load_entry_point('cloud-init==20.1', 'console_scripts', 'cloud-init')()
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 891, in main
    retval = util.log_time(
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2556, in log_time
    ret = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/devel/net_convert.py", line 95, in handle_args
    ns = network_state.parse_net_config_data(pre_ns)
  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 320, in parse_config_v2
    raise RuntimeError("No handler found for"
RuntimeError: No handler found for command 'renderer'

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Maybe netplan should skip renderer key, just like version is skipped?

tags: removed: req4focal
Changed in cloud-init (Ubuntu):
importance: Critical → Medium
Paride Legovini (paride)
Changed in cloud-init (Ubuntu):
status: New → Triaged
assignee: nobody → Ryan Harper (raharper)
Revision history for this message
Ryan Harper (raharper) wrote :
Changed in cloud-init (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 20.1-10-g71af48df-0ubuntu3

---------------
cloud-init (20.1-10-g71af48df-0ubuntu3) focal; urgency=medium

  * d/patches: redact openbsd netbsd from tests until new-upstream-snapshot
    - fix-cpick-4fb6fd8a-net-ubuntu-focal-prioritize-netplan-over-eni
  * cherry-pick 6600c642: ec2: render network on all NICs and add
    secondary IPs as (LP: #1866930)
  * cherry-pick 986f37b0: cloudinit: move to pytest for running tests
    (#211)
  * cherry-pick 4fb6fd8a: net: ubuntu focal prioritize netplan over eni
    even if both (LP: #1867029)
  * cherry-pick 04771d75: cc_disk_setup: fix RuntimeError (#270) (LP:
    #1868327)
  * cherry-pick c5e949c0: distros/tests/test_init: add tests for
  * cherry-pick 2566fdbe: net: introduce is_ip_address function (#288)
  * cherry-pick 4f825b3e: cloudinit: refactor util.is_ipv4 to
    net.is_ipv4_address
  * cherry-pick c478d0bf: distros: replace invalid characters in mirror
    URLs with (LP: #1868232)
  * cherry-pick 1bbc4908: distros: drop leading/trailing hyphens from
    mirror URL labels
  * cherry-pick 09fea85f: net: ignore 'renderer' key in netplan config
    (#306) (LP: #1870421)

 -- Chad Smith <email address hidden> Fri, 03 Apr 2020 13:57:52 -0600

Changed in cloud-init (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.