crash in cloud-init when using set-name on networkd renderer

Bug #1949407 reported by Pradip Dhara
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Undecided
Unassigned

Bug Description

When using set-name with a networkd renderer, we are hitting the following crash:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 682, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.7/site-packages/cloudinit/cmd/main.py", line 391, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3.7/site-packages/cloudinit/stages.py", line 825, in apply_network_config
    netcfg, bring_up=bring_up)
  File "/usr/lib/python3.7/site-packages/cloudinit/distros/__init__.py", line 222, in apply_network_config
    self._write_network_state(network_state)
  File "/usr/lib/python3.7/site-packages/cloudinit/distros/__init__.py", line 125, in _write_network_state
    renderer.render_network_state(network_state)
  File "/usr/lib/python3.7/site-packages/cloudinit/net/networkd.py", line 220, in render_network_state
    ret_dict = self._render_content(network_state)
  File "/usr/lib/python3.7/site-packages/cloudinit/net/networkd.py", line 245, in _render_content
    self.dhcp_domain(ns.config['ethernets'][name], cfg)
KeyError: 'eth0'

1. Tell us your cloud provider
DataSourceVMware

2. Any appropriate cloud-init configuration you can provide us
instance-id: "management-appliance-control-plane-0"
local-hostname: "management-appliance-control-plane-0"
wait-on-network:
  ipv4: false
  ipv6: false
network:
  version: 2
  ethernets:
    id0:
      match:
        macaddress: "00:50:56:9d:14:42"
      set-name: "eth0"
      wakeonlan: true
      addresses:
      - "192.168.20.30/24"
      gateway4: "192.168.20.1"
      nameservers:
        addresses:
        - "127.0.0.53"
        - ""
        - ""

3. Perform the following on the system and attach it to this bug:
Attached is the output of cloud-init collect-logs

Revision history for this message
Pradip Dhara (pradipdhara) wrote :
Revision history for this message
Pradip Dhara (pradipdhara) wrote :
Revision history for this message
James Falcon (falcojr) wrote :
Changed in cloud-init:
status: New → In Progress
Revision history for this message
Andrew Kutz (akutz) wrote :
Revision history for this message
Chad Smith (chad.smith) wrote :

Upstream commit landed with a fix for this issue. Thanks Andrew and Pradip!

https://github.com/canonical/cloud-init/commit/fff6de4a18fa4eca709870e995de99c543a4ac1c

Changed in cloud-init:
status: In Progress → Fix Committed
Revision history for this message
Brett Holman (holmanb) wrote : Fixed in cloud-init version 22.1.

This bug is believed to be fixed in cloud-init in version 22.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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