← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/bug-1081701-d into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/bug-1081701-d into lp:maas.

Commit message:
Add a warning on top of the enlistment preseed page.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1081701 in MAAS: "The metadata address mentioned in the preseed is wrong."
  https://bugs.launchpad.net/maas/+bug/1081701

For more details, see:
https://code.launchpad.net/~rvb/maas/bug-1081701-d/+merge/136161

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".
-- 
https://code.launchpad.net/~rvb/maas/bug-1081701-d/+merge/136161
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/bug-1081701-d into lp:maas.
=== modified file 'src/maasserver/templates/maasserver/enlist_preseed.html'
--- src/maasserver/templates/maasserver/enlist_preseed.html	2012-06-22 07:50:12 +0000
+++ src/maasserver/templates/maasserver/enlist_preseed.html	2012-11-26 13:04:22 +0000
@@ -5,6 +5,7 @@
 {% block page-title %}Enlistment preseed{% endblock %}
 
 {% block content %}
+  {{ warning_message }}
   <pre>
 {{ preseed }}
   </pre>

=== modified file 'src/maasserver/tests/test_views_nodes.py'
--- src/maasserver/tests/test_views_nodes.py	2012-11-08 12:58:48 +0000
+++ src/maasserver/tests/test_views_nodes.py	2012-11-26 13:04:22 +0000
@@ -644,6 +644,22 @@
                 for a in document.xpath("//div[@class='pagination']//a")])
 
 
+class NodeEnlistmentPreseedViewTest(LoggedInTestCase):
+
+    def test_enlistpreseedview_displays_preseed_data(self):
+        response = self.client.get(reverse('enlist-preseed-view'))
+        # Simply test that the preseed looks ok.
+        self.assertIn('metadata_url', response.content)
+
+    def test_enlistpreseedview_display_warning_about_url(self):
+        response = self.client.get(reverse('enlist-preseed-view'))
+        message_chunk = (
+            "The URL mentioned in the following enlistment preseed will "
+            "be different depending on"
+            )
+        self.assertIn(message_chunk, response.content)
+
+
 class NodePreseedViewTest(LoggedInTestCase):
 
     def test_preseedview_node_displays_preseed_data(self):

=== modified file 'src/maasserver/views/nodes.py'
--- src/maasserver/views/nodes.py	2012-11-08 12:58:48 +0000
+++ src/maasserver/views/nodes.py	2012-11-26 13:04:22 +0000
@@ -179,10 +179,18 @@
 
 def enlist_preseed_view(request):
     """View method to display the enlistment preseed."""
+    warning_message = (
+        "The URL mentioned in the following enlistment preseed will "
+        "be different depending on which cluster controller is "
+        "responsible for the enlisting node.  The URL shown here is for "
+        "nodes handled by the cluster controller located in the region "
+        "controller's network."
+        )
+    context = RequestContext(request, {'warning_message': warning_message})
     return render_to_response(
         'maasserver/enlist_preseed.html',
         {'preseed': mark_safe(get_enlist_preseed())},
-        context_instance=RequestContext(request))
+        context_instance=context)
 
 
 class NodeViewMixin: