-
Notifications
You must be signed in to change notification settings - Fork 818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network config is incorrectly parsed when nameservers are specified #3445
Comments
Launchpad user Moustafa Moustafa(momousta) wrote on 2019-09-10T21:13:39.584107+00:00 Launchpad attachments: cloud-init.tar.gz |
Launchpad user Ryan Harper(raharper) wrote on 2019-09-11T15:17:52.649397+00:00 Thanks for the bug and the logs. Looking at the network-config that was generated:
The bug is that nameservers needs to be indented under eth0. However, cloud-init upstream does not parse or process nameservers[1] from Azure metadata, so I can't understand why you have this bug unless the cloud-init 19.1 on SLES has some downstream patches. |
Launchpad user Robert Schweikert(rjschwei) wrote on 2019-09-11T15:33:45.358616+00:00 The SUSE cloud-init-19.1 version does not have specific patches for the Azure In prior investigation I could not figure out where the nameserver information is supposed to be coming from, not all data sources appear to provide it, including EC2 data source, yet in EC2 resolv.conf is populated correctly. |
Launchpad user Ryan Harper(raharper) wrote on 2019-09-11T15:57:14.896622+00:00 Thanks Robert, Moustafa, have you made any changes to the cloud-init package installed in your image? The network_state parser works fine if you put nameservers in the correct location under the interface name. Note that, since we're using DHCP, we ignore any specific dns_nameservers that are provided in addition due to the potential conflict if the DHCP server provides it's own DHCP DNS values. |
Launchpad user Moustafa Moustafa(momousta) wrote on 2019-09-11T23:56:41.361647+00:00 I hit that issue while I was trying to provide a hackish fix for another issue which is reported in bugs.launchpad.net/cloud-init/+bug/1843634
I tried to reverse engineer where could be a potential place to define the nameserver and the search domain and I added it in the same level as the eth0 based on my investigation which seems to be wrong in this case. When I tried to define the nameserver and the address under "eth0", I didn't get the error I was getting but still the "/etc/resolv.conf" was not populated with any nameserver or search domain. I attached the log files for that. Based on your comment I should not try to populate the nameserver or the search domain since it will be overridden anyways, But when I do so, The DNS is unreachable and the "/etc/resolv.conf" doesn't have any nameservers defined. On another note, The part that I don't understand though is in the network_state.py where the _v2_common builds a dictionary with the key "addresses" not "address" in [name_cmd.update({'addresses': dns})]. This dictionary is then passed to the handle_nameserver function which requires the key "address"! |
Launchpad user Ryan Harper(raharper) wrote on 2019-09-12T00:54:29.482965+00:00 OK, for now I'm going to mark this bug as invalid and let's sort through the bug you've filed there. |
Launchpad user Ryan Harper(raharper) wrote on 2019-09-12T00:55:01.092117+00:00 Issue is related to local changes, marking invalid. |
This bug was originally filed in Launchpad as LP: #1843502
Launchpad details
Launchpad user Moustafa Moustafa(momousta) wrote on 2019-09-10T21:13:39.584107+00:00
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']
The text was updated successfully, but these errors were encountered: