Merge lp:~rvb/maas/bug-1081701-d into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1378
Proposed branch: lp:~rvb/maas/bug-1081701-d
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 62 lines (+26/-1)
3 files modified
src/maasserver/templates/maasserver/enlist_preseed.html (+1/-0)
src/maasserver/tests/test_views_nodes.py (+16/-0)
src/maasserver/views/nodes.py (+9/-1)
To merge this branch: bzr merge lp:~rvb/maas/bug-1081701-d
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+136161@code.launchpad.net

Commit message

Add a warning on top of the enlistment preseed page.

Description of the change

This is the part d) of the action plan described in https://bugs.launchpad.net/maas/+bug/1081701/comments/8 to fix bug 1081701.

Instead of doing a too brutal refactoring, I choose to simply add a warning on the page that displays the enlistment preseed because, after all, this page is only there for "FYI".

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/templates/maasserver/enlist_preseed.html'
2--- src/maasserver/templates/maasserver/enlist_preseed.html 2012-06-22 07:50:12 +0000
3+++ src/maasserver/templates/maasserver/enlist_preseed.html 2012-11-26 13:04:22 +0000
4@@ -5,6 +5,7 @@
5 {% block page-title %}Enlistment preseed{% endblock %}
6
7 {% block content %}
8+ {{ warning_message }}
9 <pre>
10 {{ preseed }}
11 </pre>
12
13=== modified file 'src/maasserver/tests/test_views_nodes.py'
14--- src/maasserver/tests/test_views_nodes.py 2012-11-08 12:58:48 +0000
15+++ src/maasserver/tests/test_views_nodes.py 2012-11-26 13:04:22 +0000
16@@ -644,6 +644,22 @@
17 for a in document.xpath("//div[@class='pagination']//a")])
18
19
20+class NodeEnlistmentPreseedViewTest(LoggedInTestCase):
21+
22+ def test_enlistpreseedview_displays_preseed_data(self):
23+ response = self.client.get(reverse('enlist-preseed-view'))
24+ # Simply test that the preseed looks ok.
25+ self.assertIn('metadata_url', response.content)
26+
27+ def test_enlistpreseedview_display_warning_about_url(self):
28+ response = self.client.get(reverse('enlist-preseed-view'))
29+ message_chunk = (
30+ "The URL mentioned in the following enlistment preseed will "
31+ "be different depending on"
32+ )
33+ self.assertIn(message_chunk, response.content)
34+
35+
36 class NodePreseedViewTest(LoggedInTestCase):
37
38 def test_preseedview_node_displays_preseed_data(self):
39
40=== modified file 'src/maasserver/views/nodes.py'
41--- src/maasserver/views/nodes.py 2012-11-08 12:58:48 +0000
42+++ src/maasserver/views/nodes.py 2012-11-26 13:04:22 +0000
43@@ -179,10 +179,18 @@
44
45 def enlist_preseed_view(request):
46 """View method to display the enlistment preseed."""
47+ warning_message = (
48+ "The URL mentioned in the following enlistment preseed will "
49+ "be different depending on which cluster controller is "
50+ "responsible for the enlisting node. The URL shown here is for "
51+ "nodes handled by the cluster controller located in the region "
52+ "controller's network."
53+ )
54+ context = RequestContext(request, {'warning_message': warning_message})
55 return render_to_response(
56 'maasserver/enlist_preseed.html',
57 {'preseed': mark_safe(get_enlist_preseed())},
58- context_instance=RequestContext(request))
59+ context_instance=context)
60
61
62 class NodeViewMixin: