コード例 #1
0
ファイル: api.py プロジェクト: zhangrb/maas
 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")
コード例 #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)
コード例 #3
0
ファイル: nodes.py プロジェクト: cloudbase/maas
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)
コード例 #4
0
ファイル: test_preseed.py プロジェクト: deepakhajare/maas
 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))
コード例 #5
0
ファイル: test_preseed.py プロジェクト: deepakhajare/maas
 def test_get_enlist_preseed_returns_enlist_preseed(self):
     preseed = get_enlist_preseed()
     self.assertTrue(preseed.startswith('#cloud-config'))
コード例 #6
0
ファイル: api.py プロジェクト: cloudbase/maas
 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")
コード例 #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))
コード例 #8
0
 def test_get_enlist_preseed_returns_enlist_preseed(self):
     preseed = get_enlist_preseed()
     self.assertTrue(preseed.startswith('#cloud-config'))
コード例 #9
0
ファイル: test_views_nodes.py プロジェクト: deepakhajare/maas
 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)