nocloud network-config mishandles empty config

Bug #1852496 reported by Ryan Harper
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Fix Released

Bug Description

root@e1:~# cat /var/lib/cloud/seed/nocloud-net/network-config
version: 1
config: []

This causes this stacktrace:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 653, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3/dist-packages/cloudinit/cmd/", line 362, in main_init
    init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
  File "/usr/lib/python3/dist-packages/cloudinit/", line 706, in apply_network_config
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python3/dist-packages/cloudinit/distros/", line 178, in apply_network_config
    dev_names = self._write_network_config(netconfig)
  File "/usr/lib/python3/dist-packages/cloudinit/distros/", line 114, in _write_network_config
    return self._supported_write_network_config(netconfig)
  File "/usr/lib/python3/dist-packages/cloudinit/distros/", line 93, in _supported_write_network_config
  File "/usr/lib/python3/dist-packages/cloudinit/net/", line 56, in render_network_config
    templates=templates, target=target)
  File "/usr/lib/python3/dist-packages/cloudinit/net/", line 202, in render_network_state
    content = self._render_content(network_state)
  File "/usr/lib/python3/dist-packages/cloudinit/net/", line 236, in _render_content
    if network_state.version == 2:
AttributeError: 'NoneType' object has no attribute 'version'

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: cloud-init 19.2-36-g059d049c-0ubuntu3
ProcVersionSignature: Ubuntu 4.15.0-64.73~16.04.1-generic 4.15.18
Uname: Linux 4.15.0-64-generic x86_64
ApportVersion: 2.20.11-0ubuntu8.2
Architecture: amd64
Date: Wed Nov 13 21:44:48 2019
PackageArchitecture: all
 PATH=(custom, no user)
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)
 2019-11-13 21:39:21,144 -[WARNING]: failed stage init-local
 AttributeError: 'NoneType' object has no attribute 'version'
 manage_etc_hosts: localhost
 - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDeShzUvzOCPWKyfRt0IsiO4//nyDwe6JgL0ZTHO+Wq1nRsuwysdoX9sAMlhAdgx3q6qbJu6Xa3ug1c4rqyszBBovsoOieF4ZzZzrPV4ekzzAaPB5jqCIRostiIimTnxOrnyRtdZ0F81q1jzL9SfyzlzhIVYvdcleEE8c2ziaNZfAeL/cD9MB9jCcxRTNuMQw27QE2yQ4na2YAm3tB0l6vDfiLIx9hstgwyj13I5VsFcoHNohyN0R+Fq6/Zz5rOHiUieiMcs0+b/khnfYKuqygQRpPWAl35OVJUSUgVnbRQsM9TstOfy5IxFxI5oBtueVX1ZUp/xibsZo/1V3dJkKet rharper@brettanomyces

Revision history for this message
Ryan Harper (raharper) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :
Changed in cloud-init (Ubuntu):
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 19.3-74-g129b1c4e-0ubuntu1

cloud-init (19.3-74-g129b1c4e-0ubuntu1) focal; urgency=medium

  * New upstream snapshot.
    - azure: avoid re-running cloud-init when instance-id is byte-swapped
      (#84) [AOhassan]
    - fix unlocking method on FreeBSD [Igor Galić] (LP: #1854594)
    - debian: add reference to the manpages [Joshua Powers]
    - ds_identify: if /sys is not available use dmidecode (#42)
      [Igor Galić] (LP: #1852442)
    - docs: add cloud-id manpage [Joshua Powers]
    - docs: add cloud-init-per manpage [Joshua Powers]
    - docs: add cloud-init manpage [Joshua Powers]
    - docs: add additional details to per-instance/once [Joshua Powers]
    - Merge pull request #96 from fred-lefebvre/master [Joshua Powers]
    - Update doc-requirements.txt [Joshua Powers]
    - doc-requirements: add missing dep [Joshua Powers]
    - Merge pull request #95 from powersj/docs/bugs [Joshua Powers]
    - dhcp: Support RedHat dhcp rfc3442 lease format for option 121 (#76)
      [Eric Lafontaine] (LP: #1850642)
    - network_state: handle empty v1 config (#45) (LP: #1852496)
    - Merge pull request #94 from gaughen/patch-1 [Joshua Powers]
    - docs: fix line length and remove highlighting [Joshua Powers]
    - docs: Add to readthedocs [Joshua Powers]
    - Multiple file fix for AuthorizedKeysFile config (#60) [Eduardo Otubo]
    - Merge pull request #88 from OddBloke/travis [Joshua Powers]
    - doc: update links on [Joshua Powers]
    - doc: Updates to wording of [Joshua Powers]
    - Add [Joshua Powers]
    - Amazon Linux sets libexec to /usr/libexec (#52)
      [Frederick Lefebvre]

 -- Chad Smith <email address hidden> Thu, 12 Dec 2019 16:05:35 -0700

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

Remote bug watches

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