Public bug reported:

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

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1663045

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

Status in cloud-init:
  New

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1663045/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to