Exemple #1
0
 def get_enlist_preseed(self, request, version=None):
     """Render and return a preseed script for enlistment."""
     rack_controller = find_rack_controller(request)
     # XXX: Set a charset for text/plain. Django automatically encodes
     # non-binary content using DEFAULT_CHARSET (which is UTF-8 by default)
     # but only sets the charset parameter in the content-type header when
     # a content-type is NOT provided.
     preseed = get_enlist_preseed(request, rack_controller=rack_controller)
     return HttpResponse(preseed, content_type="text/plain")
Exemple #2
0
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=context)
Exemple #3
0
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=context)
Exemple #4
0
 def test_compose_enlistment_preseed_url_links_to_enlistment_preseed(self):
     response = self.client.get(compose_enlistment_preseed_url())
     self.assertEqual(
         (httplib.OK, get_enlist_preseed()),
         (response.status_code, response.content))
Exemple #5
0
 def test_get_enlist_preseed_returns_enlist_preseed(self):
     preseed = get_enlist_preseed()
     self.assertTrue(preseed.startswith('#cloud-config'))
Exemple #6
0
 def get_enlist_preseed(self, request, version=None):
     """Render and return a preseed script for enlistment."""
     nodegroup = find_nodegroup(request)
     return HttpResponse(
         get_enlist_preseed(nodegroup=nodegroup), mimetype="text/plain")
Exemple #7
0
 def test_compose_enlistment_preseed_url_links_to_enlistment_preseed(self):
     response = self.client.get(compose_enlistment_preseed_url())
     self.assertEqual((httplib.OK, get_enlist_preseed()),
                      (response.status_code, response.content))
Exemple #8
0
 def test_get_enlist_preseed_returns_enlist_preseed(self):
     preseed = get_enlist_preseed()
     self.assertTrue(preseed.startswith('#cloud-config'))
 def test_enlist_preseed_displays_enlist_preseed(self):
     enlist_preseed_link = reverse('enlist-preseed-view')
     response = self.client.get(enlist_preseed_link)
     self.assertIn(get_enlist_preseed(), response.content)