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

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

Commit message

The domain for the node needs to be listed first in the search directive in resolv.conf.

Description of the change

The domain for the node needs to be listed first in the search directive in resolv.conf.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Fix looks good, but I'm not quite sure how the test tests this specific fix?

review: Needs Information
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Ah, I didn't realize the first argument to the NodeGroup factory was the domain name. Never mind on part of my comment, but I still wonder where in the test we make sure the node's domain comes first?

Revision history for this message
LaMont Jones (lamont) wrote :

> Ah, I didn't realize the first argument to the NodeGroup factory was the
> domain name. Never mind on part of my comment, but I still wonder where in the
> test we make sure the node's domain comes first?

collectDNSConfig in the test file generates the expected config, and has been changed to always put the domain portion of the fqdn of the node in ahead of the sorted dns search list (and pruning dupes as it goes.)

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Got it. Sounds good; thanks!

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-07-17 00:28:01 +0000
+++ docs/changelog.rst 2016-10-24 23:42:39 +0000
@@ -5,6 +5,8 @@
51.9.551.9.5
6=====6=====
77
8LP: #1636251 [1.9] resolv.conf search path doesn't match the domain for the host.
9
8LP: #1603590 [1.9] MAAS does not allow link-local address for default gateway on ipv6 subnet.10LP: #1603590 [1.9] MAAS does not allow link-local address for default gateway on ipv6 subnet.
911
101.9.4121.9.4
1113
=== modified file 'src/maasserver/preseed_network.py'
--- src/maasserver/preseed_network.py 2015-11-09 19:39:43 +0000
+++ src/maasserver/preseed_network.py 2016-10-24 23:42:39 +0000
@@ -58,10 +58,15 @@
58 # Order the network_config where dependencies come first.58 # Order the network_config where dependencies come first.
59 self._order_config_dependency()59 self._order_config_dependency()
6060
61 domain_name = self.node.fqdn.split('.', 1)[1]
62 search_list = [domain_name] + [
63 name
64 for name in sorted(get_dns_search_paths())
65 if name != domain_name]
61 self.network_config.append({66 self.network_config.append({
62 "type": "nameserver",67 "type": "nameserver",
63 "address": get_dns_server_address(nodegroup=self.node.nodegroup),68 "address": get_dns_server_address(nodegroup=self.node.nodegroup),
64 "search": sorted(get_dns_search_paths()),69 "search": search_list,
65 })70 })
6671
67 network_config = {72 network_config = {
6873
=== modified file 'src/maasserver/tests/test_preseed_network.py'
--- src/maasserver/tests/test_preseed_network.py 2015-11-09 19:39:43 +0000
+++ src/maasserver/tests/test_preseed_network.py 2016-10-24 23:42:39 +0000
@@ -213,7 +213,11 @@
213 def collectDNSConfig(self, node):213 def collectDNSConfig(self, node):
214 config = "- type: nameserver\n address: %s\n search:\n" % (214 config = "- type: nameserver\n address: %s\n search:\n" % (
215 get_dns_server_address(nodegroup=node.nodegroup))215 get_dns_server_address(nodegroup=node.nodegroup))
216 dns_searches = sorted(get_dns_search_paths())216 domain_name = node.fqdn.split('.', 1)[1]
217 dns_searches = [domain_name] + [
218 name
219 for name in sorted(get_dns_search_paths())
220 if name != domain_name]
217 for dns_name in dns_searches:221 for dns_name in dns_searches:
218 config += " - %s\n" % dns_name222 config += " - %s\n" % dns_name
219 return config223 return config
@@ -222,8 +226,14 @@
222class TestSimpleNetworkLayout(MAASServerTestCase, AssertNetworkConfigMixin):226class TestSimpleNetworkLayout(MAASServerTestCase, AssertNetworkConfigMixin):
223227
224 def test__renders_expected_output(self):228 def test__renders_expected_output(self):
229 factory.make_NodeGroup(
230 name=factory.make_name('aaa'))
231 nodegroup = factory.make_NodeGroup(
232 name=factory.make_name('bbb'))
233 factory.make_NodeGroup(
234 name=factory.make_name('ccc'))
225 node = factory.make_Node_with_Interface_on_Subnet(235 node = factory.make_Node_with_Interface_on_Subnet(
226 interface_count=2)236 interface_count=2, nodegroup=nodegroup)
227 for iface in node.interface_set.filter(enabled=True):237 for iface in node.interface_set.filter(enabled=True):
228 factory.make_StaticIPAddress(238 factory.make_StaticIPAddress(
229 interface=iface,239 interface=iface,

Subscribers

People subscribed via source and target branches