← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1843502] [NEW] Network config is incorrectly parsed when nameservers are specified

 

Public bug reported:

The issue was reproduced on Azure with cloud-init 19.1 on a SLES12 SP4 machine. Looking at the code, the same behavior could be reproduced on any other configuration where the cloud provider specifies nameservers in the network configuration.
The specified nameservers in network configuration are ignored and cloud-init raises an error.
In network_state.py the function _v2_common builds a name_cmd dictionary which is then passed to the function handle_nameserver. The handle_nameserver has a decorator that enforces that passed in dictionary to have the key "address". But the _v2_common build a dictionary that has the key "addresses" instead. That results in raising an error.
Here's a snapshot of the cloud-init.log

2019-09-09 16:21:29,479 - network_state.py[DEBUG]: v2(nameserver) -> v1(nameserver):
{'search': 'xkf00b0rtzgejkug4xc2pcinre.xx.internal.cloudapp.net', 'type': 'nameserver', 'addresses': '168.63.129.16'}
2019-09-09 16:21:29,479 - network_state.py[WARNING]: Skipping invalid command: {'nameservers': {'search': 'xkf00b0rtzgejkug4xc2pcinre.xx.internal.cloudapp.net', 'addresses': '168.63.129.16'}, 'eth0': {'set-name': 'eth0', 'match': {'macaddress': u'00:0d:3a:6d:ca:25'}, 'dhcp4': True}}
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 321, in parse_config_v2
    self._v2_common(command)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 697, in _v2_common
    self.handle_nameserver(name_cmd)
  File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 118, in decorator
    required_keys))
InvalidCommand: Command missing set(['address']) of required keys ['address']

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

** Attachment added: "cloud-init.tar.gz"
   https://bugs.launchpad.net/bugs/1843502/+attachment/5287866/+files/cloud-init.tar.gz

-- 
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/1843502

Title:
  Network config is incorrectly parsed when  nameservers are specified

Status in cloud-init:
  New

Bug description:
  The issue was reproduced on Azure with cloud-init 19.1 on a SLES12 SP4 machine. Looking at the code, the same behavior could be reproduced on any other configuration where the cloud provider specifies nameservers in the network configuration.
  The specified nameservers in network configuration are ignored and cloud-init raises an error.
  In network_state.py the function _v2_common builds a name_cmd dictionary which is then passed to the function handle_nameserver. The handle_nameserver has a decorator that enforces that passed in dictionary to have the key "address". But the _v2_common build a dictionary that has the key "addresses" instead. That results in raising an error.
  Here's a snapshot of the cloud-init.log

  2019-09-09 16:21:29,479 - network_state.py[DEBUG]: v2(nameserver) -> v1(nameserver):
  {'search': 'xkf00b0rtzgejkug4xc2pcinre.xx.internal.cloudapp.net', 'type': 'nameserver', 'addresses': '168.63.129.16'}
  2019-09-09 16:21:29,479 - network_state.py[WARNING]: Skipping invalid command: {'nameservers': {'search': 'xkf00b0rtzgejkug4xc2pcinre.xx.internal.cloudapp.net', 'addresses': '168.63.129.16'}, 'eth0': {'set-name': 'eth0', 'match': {'macaddress': u'00:0d:3a:6d:ca:25'}, 'dhcp4': True}}
  Traceback (most recent call last):
    File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 321, in parse_config_v2
      self._v2_common(command)
    File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 697, in _v2_common
      self.handle_nameserver(name_cmd)
    File "/usr/lib/python2.7/site-packages/cloudinit/net/network_state.py", line 118, in decorator
      required_keys))
  InvalidCommand: Command missing set(['address']) of required keys ['address']

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


Follow ups