← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/fix-enlist-preseed into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/fix-enlist-preseed into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/fix-enlist-preseed/+merge/118335

This branch fixes the enlistment preseed template.  The way we build the server url (from the server host) in this template will break when using a demo instance (the '/MAAS' part is hardcoded): instead, use absolute_reverse which, internally, uses DEFAULT_MAAS_URL.  

Note that this introduces a bug in production because DEFAULT_MAAS_URL does not include the '/MAAS' part.  That is a bug in the packaging (because the packaging defines a custom DEFAULT_MAAS_URL in /etc/maas/maas_local_settings.py).  I'll fix that in another branch and land the follow-up branch right after this one.

Note that I didn't fix the cobbler template contrib/preseeds/maas-enlist.preseed because it will soon be deleted.
-- 
https://code.launchpad.net/~rvb/maas/fix-enlist-preseed/+merge/118335
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/fix-enlist-preseed into lp:maas.
=== modified file 'contrib/preseeds_v2/enlist'
--- contrib/preseeds_v2/enlist	2012-08-02 21:01:29 +0000
+++ contrib/preseeds_v2/enlist	2012-08-06 11:44:19 +0000
@@ -5,6 +5,6 @@
     max_wait : 120
     # there are no default values for metadata_url or oauth credentials
     # If no credentials are present, non-authed attempts will be made.
-    metadata_url: http://{{server_host}}/MAAS/metadata/enlist
+    metadata_url: {{metadata_enlist_url}}
 
 output: {all: '| tee -a /var/log/cloud-init-output.log'}

=== modified file 'src/maasserver/preseed.py'
--- src/maasserver/preseed.py	2012-08-06 09:28:31 +0000
+++ src/maasserver/preseed.py	2012-08-06 11:44:19 +0000
@@ -214,6 +214,7 @@
     context = {
         'release': release,
         'server_host': server_host,
+        'metadata_enlist_url': absolute_reverse('enlist'),
         }
     if node is not None:
         # Create the url and the url-data (POST parameters) used to turn off

=== modified file 'src/maasserver/tests/test_preseed.py'
--- src/maasserver/tests/test_preseed.py	2012-08-06 09:28:31 +0000
+++ src/maasserver/tests/test_preseed.py	2012-08-06 11:44:19 +0000
@@ -306,7 +306,8 @@
         release = factory.getRandomString()
         context = get_preseed_context(node, release)
         self.assertItemsEqual(
-            ['node', 'release', 'server_host', 'preseed_data',
+            ['node', 'release', 'metadata_enlist_url',
+             'server_host', 'preseed_data',
              'node_disable_pxe_url', 'node_disable_pxe_data'],
             context)
 
@@ -317,7 +318,7 @@
         release = factory.getRandomString()
         context = get_preseed_context(None, release)
         self.assertItemsEqual(
-            ['release', 'server_host'],
+            ['release', 'metadata_enlist_url', 'server_host'],
             context)