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: 5201
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.
lp:~lamont/maas/bug-1636251-2.0 updated
5201. By LaMont Jones

Update changelog.

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
1=== modified file 'docs/changelog.rst'
2--- docs/changelog.rst 2016-08-22 23:21:36 +0000
3+++ docs/changelog.rst 2016-10-25 20:24:42 +0000
4@@ -8,6 +8,8 @@
5 Issues fixed in this release
6 ----------------------------
7
8+LP: #1636251 resolv.conf search path doesn't match the domain for the host.
9+
10 LP: #1615686 Single-IP dynamic ranges resulted in internal errors.
11
12 2.0.0
13
14=== modified file 'src/maasserver/preseed_network.py'
15--- src/maasserver/preseed_network.py 2016-07-15 02:18:08 +0000
16+++ src/maasserver/preseed_network.py 2016-10-25 20:24:42 +0000
17@@ -47,10 +47,14 @@
18 # Order the network_config where dependencies come first.
19 self._order_config_dependency()
20
21+ search_list = [self.node.domain.name] + [
22+ name
23+ for name in sorted(get_dns_search_paths())
24+ if name != self.node.domain.name]
25 self.network_config.append({
26 "type": "nameserver",
27 "address": self.dns_servers,
28- "search": sorted(get_dns_search_paths()),
29+ "search": search_list,
30 })
31
32 network_config = {
33
34=== modified file 'src/maasserver/tests/test_preseed_network.py'
35--- src/maasserver/tests/test_preseed_network.py 2016-07-15 02:18:08 +0000
36+++ src/maasserver/tests/test_preseed_network.py 2016-10-25 20:24:42 +0000
37@@ -201,7 +201,11 @@
38 def collectDNSConfig(self, node):
39 config = "- type: nameserver\n address: %s\n search:\n" % (
40 repr(node.get_default_dns_servers()))
41- dns_searches = sorted(get_dns_search_paths())
42+ domain_name = node.domain.name
43+ dns_searches = [domain_name] + [
44+ name
45+ for name in sorted(get_dns_search_paths())
46+ if name != domain_name]
47 for dns_name in dns_searches:
48 config += " - %s\n" % dns_name
49 return config
50@@ -210,8 +214,13 @@
51 class TestSimpleNetworkLayout(MAASServerTestCase, AssertNetworkConfigMixin):
52
53 def test__renders_expected_output(self):
54+ # Force it to have a domain name in the middle of two others. This
55+ # will confirm that sorting is working correctly.
56+ factory.make_Domain('aaa')
57+ domain = factory.make_Domain('bbb')
58+ factory.make_Domain('ccc')
59 node = factory.make_Node_with_Interface_on_Subnet(
60- interface_count=2)
61+ interface_count=2, domain=domain)
62 for iface in node.interface_set.filter(enabled=True):
63 factory.make_StaticIPAddress(
64 interface=iface,

Subscribers

People subscribed via source and target branches

to all changes: