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

Bug #1663045 reported by Jon Gjengset
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Unassigned

Bug Description

In distros/arch.py, 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/main.py", line 513, in status_wrap
ret = functor(name, args)
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 254, in main_init
init.apply_network_config(bring_up=not args.local)
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", 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/__init__.py", line 154, in app
netconfig, bring_up=bring_up)
File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 143, in _ap
return self.apply_network(contents, bring_up=bring_up)
File "/usr/lib/python2.7/site-packages/cloudinit/distros/__init__.py", line 125, in app
dev_names = self._write_network(settings)
File "/usr/lib/python2.7/site-packages/cloudinit/distros/arch.py", line 67, in _write_n
'DNS': str(tuple(info.get('dns-nameservers'))).replace(',', '')
TypeError: 'NoneType' object is not iterable
------------------------------------------------------------

The fix proposed in https://bbs.archlinux.org/viewtopic.php?pid=1662566#p1662566 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

~smoser/cloud-init:bug/1663045-archlinux-empty-dns
Server Team CI bot: Approve (continuous-integration)
Rich Lees (community): Approve (visual, basic testing)
cloud-init Commiters: Pending requested
Diff: 193 lines (+125/-31)
3 files modified
cloudinit/distros/arch.py (+59/-31)
tests/unittests/test_distros/__init__.py (+21/-0)
tests/unittests/test_distros/test_arch.py (+45/-0)
api
~powersj/cloud-init:fix-arch-dns
Rejected for merging into cloud-init:master
Server Team CI bot: Approve (continuous-integration)
cloud-init Commiters: Pending requested
Diff: 93 lines (+59/-9)
2 files modified
cloudinit/distros/arch.py (+17/-9)
tests/unittests/test_distros/test_netctl.py (+42/-0)
api
Revision history for this message
Jon Gjengset (jonhoo) wrote :
Revision history for this message
Jon Gjengset (jonhoo) wrote :
Joshua Powers (powersj)
Changed in cloud-init:
status: New → Confirmed
Scott Moser (smoser)
Changed in cloud-init:
importance: Undecided → Medium
Scott Moser (smoser)
Changed in cloud-init:
status: Confirmed → Fix Committed
Revision history for this message

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
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.

AltStyle によって変換されたページ (->オリジナル) /