diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-07 09:50:42 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-07 22:03:29 +0100 |
commit | 4aaf7780ad11690f2593078876f7b22726a14178 (patch) | |
tree | 334853f74e3c416a77fe22a2d9be2ee45be17034 | |
parent | 7c0423fc13326bb44f33fce8d7a8e698961eaa9c (diff) |
Stop setting 8.8.8.8 as default DNS server
That could easily raise side effect as it overrides default configs
set by Cloud providers.
Change-Id: I659d16f8f58bba3a07b8ae2ee2270aa69c200ed5
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r-- | snaps/config/network.py | 5 | ||||
-rw-r--r-- | snaps/config/tests/network_tests.py | 8 | ||||
-rw-r--r-- | snaps/openstack/tests/create_network_tests.py | 10 |
3 files changed, 8 insertions, 15 deletions
diff --git a/snaps/config/network.py b/snaps/config/network.py index 39a4254..cdd8bdd 100644 --- a/snaps/config/network.py +++ b/snaps/config/network.py @@ -221,10 +221,7 @@ class SubnetConfig(object): if 'dns_nameservers' in kwargs: self.dns_nameservers = kwargs.get('dns_nameservers') else: - if self.ip_version == 4: - self.dns_nameservers = ['8.8.8.8'] - else: - self.dns_nameservers = list() + self.dns_nameservers = list() self.host_routes = kwargs.get('host_routes') self.destination = kwargs.get('destination') diff --git a/snaps/config/tests/network_tests.py b/snaps/config/tests/network_tests.py index 43b69c7..62ce067 100644 --- a/snaps/config/tests/network_tests.py +++ b/snaps/config/tests/network_tests.py @@ -15,7 +15,7 @@ import unittest from snaps.config.network import ( - NetworkConfigError, NetworkConfig, SubnetConfig, SubnetConfigError, + NetworkConfigError, NetworkConfig, SubnetConfig, SubnetConfigError, IPv6Mode, PortConfig, PortConfigError) @@ -122,8 +122,7 @@ class SubnetConfigUnitTests(unittest.TestCase): self.assertIsNone(settings.start) self.assertIsNone(settings.end) self.assertIsNone(settings.enable_dhcp) - self.assertEqual(1, len(settings.dns_nameservers)) - self.assertEqual('8.8.8.8', settings.dns_nameservers[0]) + self.assertEqual(0, len(settings.dns_nameservers)) self.assertIsNone(settings.host_routes) self.assertIsNone(settings.destination) self.assertIsNone(settings.nexthop) @@ -140,8 +139,7 @@ class SubnetConfigUnitTests(unittest.TestCase): self.assertIsNone(settings.end) self.assertIsNone(settings.gateway_ip) self.assertIsNone(settings.enable_dhcp) - self.assertEqual(1, len(settings.dns_nameservers)) - self.assertEqual('8.8.8.8', settings.dns_nameservers[0]) + self.assertEqual(0, len(settings.dns_nameservers)) self.assertIsNone(settings.host_routes) self.assertIsNone(settings.destination) self.assertIsNone(settings.nexthop) diff --git a/snaps/openstack/tests/create_network_tests.py b/snaps/openstack/tests/create_network_tests.py index 966cbd0..62d9bd9 100644 --- a/snaps/openstack/tests/create_network_tests.py +++ b/snaps/openstack/tests/create_network_tests.py @@ -136,8 +136,7 @@ class SubnetSettingsUnitTests(unittest.TestCase): self.assertIsNone(settings.start) self.assertIsNone(settings.end) self.assertIsNone(settings.enable_dhcp) - self.assertEqual(1, len(settings.dns_nameservers)) - self.assertEqual('8.8.8.8', settings.dns_nameservers[0]) + self.assertEqual(0, len(settings.dns_nameservers)) self.assertIsNone(settings.host_routes) self.assertIsNone(settings.destination) self.assertIsNone(settings.nexthop) @@ -154,8 +153,7 @@ class SubnetSettingsUnitTests(unittest.TestCase): self.assertIsNone(settings.end) self.assertIsNone(settings.gateway_ip) self.assertIsNone(settings.enable_dhcp) - self.assertEqual(1, len(settings.dns_nameservers)) - self.assertEqual('8.8.8.8', settings.dns_nameservers[0]) + self.assertEqual(0, len(settings.dns_nameservers)) self.assertIsNone(settings.host_routes) self.assertIsNone(settings.destination) self.assertIsNone(settings.nexthop) @@ -540,7 +538,7 @@ class CreateNetworkSuccessTests(OSIntegrationTestCase): class CreateNetworkIPv6Tests(OSIntegrationTestCase): """ - Test for the CreateNetwork class defined in create_nework.py when + Test for the CreateNetwork class defined in create_nework.py when """ def setUp(self): @@ -627,7 +625,7 @@ class CreateNetworkIPv6Tests(OSIntegrationTestCase): self.assertEqual(subnet4_settings.name, subnet4.name) self.assertEqual(subnet4_settings.cidr, subnet4.cidr) self.assertEqual(4, subnet4.ip_version) - self.assertEqual(1, len(subnet4.dns_nameservers)) + self.assertEqual(0, len(subnet4.dns_nameservers)) # Validate IPv6 subnet self.assertEqual(network.id, subnet6.network_id) |