diff options
author | Robert Schweikert <rjschwei@suse.com> | 2019-01-23 22:35:32 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-01-23 22:35:32 +0000 |
commit | b74ebca563a21332b29482c8029e7908f60225a4 (patch) | |
tree | f1d6abf264583b77fbab2de41f68a17b99403003 /tests | |
parent | 3861102fcaf47a882516d8b6daab518308eb3086 (diff) | |
download | vyos-cloud-init-b74ebca563a21332b29482c8029e7908f60225a4.tar.gz vyos-cloud-init-b74ebca563a21332b29482c8029e7908f60225a4.zip |
net/sysconfig: do not write a resolv.conf file with only the header.
Writing the file with no dns information may prevent distro tools
from writing a resolv.conf file with dns information obtained from
a dhcp server.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/test_net.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py index d679e92c..5313d2df 100644 --- a/tests/unittests/test_net.py +++ b/tests/unittests/test_net.py @@ -2098,6 +2098,10 @@ TYPE=Ethernet USERCTL=no """ self.assertEqual(expected, found[nspath + 'ifcfg-interface0']) + # The configuration has no nameserver information make sure we + # do not write the resolv.conf file + respath = '/etc/resolv.conf' + self.assertNotIn(respath, found.keys()) def test_config_with_explicit_loopback(self): ns = network_state.parse_net_config_data(CONFIG_V1_EXPLICIT_LOOPBACK) @@ -2456,6 +2460,10 @@ TYPE=Ethernet USERCTL=no """ self.assertEqual(expected, found[nspath + 'ifcfg-interface0']) + # The configuration has no nameserver information make sure we + # do not write the resolv.conf file + respath = '/etc/resolv.conf' + self.assertNotIn(respath, found.keys()) def test_config_with_explicit_loopback(self): ns = network_state.parse_net_config_data(CONFIG_V1_EXPLICIT_LOOPBACK) |