← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~smoser/maas/enlist-cleanup into lp:maas

 

Scott Moser has proposed merging lp:~smoser/maas/enlist-cleanup into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~smoser/maas/enlist-cleanup/+merge/118193

shutdown after enlistment and try make console aware

on successful enlistment, shut the system down.
on failed enlistment, show 

Also, do not specify a MAC address, which means maas-enlist
will grab all the available network interfaces.

-- 
https://code.launchpad.net/~smoser/maas/enlist-cleanup/+merge/118193
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~smoser/maas/enlist-cleanup into lp:maas.
=== modified file 'contrib/preseeds_v2/enlist_userdata'
--- contrib/preseeds_v2/enlist_userdata	2012-08-02 21:01:29 +0000
+++ contrib/preseeds_v2/enlist_userdata	2012-08-03 20:30:26 +0000
@@ -2,10 +2,32 @@
 
 # could/should set local mirror here or proxy here
 # apt_proxy: http://{{server_host}}:8000/
-# apt_proxy: http://{{server_host}}:8000/
+
+misc_bucket:
+ - &maas_enlist |
+   # we could obtain the interface that booted from the kernel cmdline
+   # thanks to 'IPAPPEND' (http://www.syslinux.org/wiki/index.php/SYSLINUX)
+   host="{{server_host}}"
+   maas-enlist --serverurl "$host" >/tmp/enlist.out
+   if [ $? -eq 0 ]; then
+      echo
+      echo "=== $(date -R): successfully enlisted system to $host ==="
+      cat  /tmp/enlist.out
+      echo =============================================
+      sleep 10
+   else
+      # we could set a password here and allow user at console to login
+      echo
+      echo =============================================
+      echo "failed to enlist system maas server '$host'"
+      echo "sleeping 60 seconds then poweroff"
+      cat /tmp/enlist.out
+      echo =============================================
+      sleep 60
+   fi
+   poweroff
+
 packages: [ maas-enlist ]
 output: {all: '| tee -a /var/log/cloud-init-output.log'}
 runcmd:
- - [ maas-enlist, --serverurl, {{server_host}}, --interface, eth0 ]
-
-## the interface above needs probably to be done by 'auto'
+ - [ sh, -c, *maas_enlist ]