Arch distro fails to write network config with empty dns-nameservers

Bug #1663045 reported by Jon Gjengset on 2017-02-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

In distros/, the network configuration is created using

'DNS': str(tuple(info.get('dns-nameservers'))).replace(',', '')

However, when dns-nameservers is None, this causes both cloud-init and cloud-init-local to fail with

failed run of stage init-local
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/", line 513, in status_wrap
    ret = functor(name, args)
  File "/usr/lib/python2.7/site-packages/cloudinit/cmd/", line 254, in main_init
    init.apply_network_config(bring_up=not args.local)
  File "/usr/lib/python2.7/site-packages/cloudinit/", line 641, in apply_network
    return self.distro.apply_network_config(netcfg, bring_up=bring_up)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/", line 154, in app
    netconfig, bring_up=bring_up)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/", line 143, in _ap
    return self.apply_network(contents, bring_up=bring_up)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/", line 125, in app
    dev_names = self._write_network(settings)
  File "/usr/lib/python2.7/site-packages/cloudinit/distros/", line 67, in _write_n
    'DNS': str(tuple(info.get('dns-nameservers'))).replace(',', '')
TypeError: 'NoneType' object is not iterable

The fix proposed in seems to work for me, namely replacing the line with

'DNS': str(tuple(info.get('dns-nameservers'))).replace(',', '') if info.get('dns-nameservers') != None else None

Related branches

Jon Gjengset (jonhoo) wrote :
Joshua Powers (powersj) on 2017-07-21
Changed in cloud-init:
status: New → Confirmed
Scott Moser (smoser) on 2017-07-31
Changed in cloud-init:
importance: Undecided → Medium
Scott Moser (smoser) on 2017-08-01
Changed in cloud-init:
status: Confirmed → Fix Committed

This bug is believed to be fixed in cloud-init in 17.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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers