Merge lp:~lamont/maas/bug-1636251-2.0 into lp:maas/2.0

Proposed by LaMont Jones
Status: Merged
Approved by: LaMont Jones
Approved revision: no longer in the source branch.
Merged at revision: 5200
Proposed branch: lp:~lamont/maas/bug-1636251-2.0
Merge into: lp:maas/2.0
Diff against target: 64 lines (+18/-3)
3 files modified
docs/changelog.rst (+2/-0)
src/maasserver/preseed_network.py (+5/-1)
src/maasserver/tests/test_preseed_network.py (+11/-2)
To merge this branch: bzr merge lp:~lamont/maas/bug-1636251-2.0
Reviewer Review Type Date Requested Status
LaMont Jones (community) Approve
Review via email: mp+309295@code.launchpad.net

Commit message

Make sure that the host's domain is listed first in the search list, so that it knows its fqdn.

Description of the change

Make sure that the host's domain is listed first in the search list, so that it knows its fqdn.

To post a comment you must log in.
Revision history for this message
LaMont Jones (lamont) wrote :

Trivial backport

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'docs/changelog.rst'
--- docs/changelog.rst 2016-08-22 23:21:36 +0000
+++ docs/changelog.rst 2016-10-25 20:24:42 +0000
@@ -8,6 +8,8 @@
8Issues fixed in this release8Issues fixed in this release
9----------------------------9----------------------------
1010
11LP: #1636251 resolv.conf search path doesn't match the domain for the host.
12
11LP: #1615686 Single-IP dynamic ranges resulted in internal errors.13LP: #1615686 Single-IP dynamic ranges resulted in internal errors.
1214
132.0.0152.0.0
1416
=== modified file 'src/maasserver/preseed_network.py'
--- src/maasserver/preseed_network.py 2016-07-15 02:18:08 +0000
+++ src/maasserver/preseed_network.py 2016-10-25 20:24:42 +0000
@@ -47,10 +47,14 @@
47 # Order the network_config where dependencies come first.47 # Order the network_config where dependencies come first.
48 self._order_config_dependency()48 self._order_config_dependency()
4949
50 search_list = [self.node.domain.name] + [
51 name
52 for name in sorted(get_dns_search_paths())
53 if name != self.node.domain.name]
50 self.network_config.append({54 self.network_config.append({
51 "type": "nameserver",55 "type": "nameserver",
52 "address": self.dns_servers,56 "address": self.dns_servers,
53 "search": sorted(get_dns_search_paths()),57 "search": search_list,
54 })58 })
5559
56 network_config = {60 network_config = {
5761
=== modified file 'src/maasserver/tests/test_preseed_network.py'
--- src/maasserver/tests/test_preseed_network.py 2016-07-15 02:18:08 +0000
+++ src/maasserver/tests/test_preseed_network.py 2016-10-25 20:24:42 +0000
@@ -201,7 +201,11 @@
201 def collectDNSConfig(self, node):201 def collectDNSConfig(self, node):
202 config = "- type: nameserver\n address: %s\n search:\n" % (202 config = "- type: nameserver\n address: %s\n search:\n" % (
203 repr(node.get_default_dns_servers()))203 repr(node.get_default_dns_servers()))
204 dns_searches = sorted(get_dns_search_paths())204 domain_name = node.domain.name
205 dns_searches = [domain_name] + [
206 name
207 for name in sorted(get_dns_search_paths())
208 if name != domain_name]
205 for dns_name in dns_searches:209 for dns_name in dns_searches:
206 config += " - %s\n" % dns_name210 config += " - %s\n" % dns_name
207 return config211 return config
@@ -210,8 +214,13 @@
210class TestSimpleNetworkLayout(MAASServerTestCase, AssertNetworkConfigMixin):214class TestSimpleNetworkLayout(MAASServerTestCase, AssertNetworkConfigMixin):
211215
212 def test__renders_expected_output(self):216 def test__renders_expected_output(self):
217 # Force it to have a domain name in the middle of two others. This
218 # will confirm that sorting is working correctly.
219 factory.make_Domain('aaa')
220 domain = factory.make_Domain('bbb')
221 factory.make_Domain('ccc')
213 node = factory.make_Node_with_Interface_on_Subnet(222 node = factory.make_Node_with_Interface_on_Subnet(
214 interface_count=2)223 interface_count=2, domain=domain)
215 for iface in node.interface_set.filter(enabled=True):224 for iface in node.interface_set.filter(enabled=True):
216 factory.make_StaticIPAddress(225 factory.make_StaticIPAddress(
217 interface=iface,226 interface=iface,

Subscribers

People subscribed via source and target branches

to all changes: