← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/p-sru-pkg-bug-1086239 into lp:~maas-maintainers/maas/packaging.precise.sru

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/p-sru-pkg-bug-1086239 into lp:~maas-maintainers/maas/packaging.precise.sru.

Commit message:
Backport packaging r156 to Precise SRU packaging branch.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~jtv/maas/p-sru-pkg-bug-1086239/+merge/139459

This is the same backport I've already landed for the packaging and packaging.quantal branches, but this time, for the Precise packaging branch.

Unfortunately I can't test the resulting package.  The Precise SRU package is apparently broken at the moment, and specifically, there's no installable python-txtftpd.  Raphael asked me to land this first.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/p-sru-pkg-bug-1086239/+merge/139459
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/maas/p-sru-pkg-bug-1086239 into lp:~maas-maintainers/maas/packaging.precise.sru.
=== modified file 'debian/changelog'
--- debian/changelog	2012-12-04 16:12:43 +0000
+++ debian/changelog	2012-12-12 12:53:47 +0000
@@ -1,4 +1,4 @@
-maas (0.1+bzr1325+dfsg-0ubuntu1) UNRELEASED; urgency=low
+maas (0.1+bzr1335+dfsg-0ubuntu1) UNRELEASED; urgency=low
 
   * New upstream bugfix release. Fixes:
     - The DNS configuration is not created if maas-dns is installed after
@@ -57,6 +57,12 @@
   * debian/maas-cluster-controller.install: maas-import-squashfs and its
     configuration file are no longer part of upstream.
 
+  [ Jeroen Vermeulen ]
+  * debian/maas-cluster-controller.maas-pserv.upstart: Source maas_cluster.conf
+    before starting pserv (tftpd) process.
+  * debian/maas-cluster-controller.postinst: Duplicate CLUSTER_UUID setting
+    to maas_cluster.conf.
+
  -- Andres Rodriguez <andreserl@xxxxxxxxxx>  Tue, 13 Nov 2012 14:58:21 -0500
 
 maas (0.1+bzr1269+dfsg-0ubuntu1) quantal-proposed; urgency=low

=== modified file 'debian/maas-cluster-controller.maas-pserv.upstart'
--- debian/maas-cluster-controller.maas-pserv.upstart	2012-09-25 08:02:30 +0000
+++ debian/maas-cluster-controller.maas-pserv.upstart	2012-12-12 12:53:47 +0000
@@ -10,5 +10,19 @@
 
 respawn
 
-# To add options to your daemon, edit the line below:
-exec /usr/bin/twistd -n --uid=maas --gid=maas --pidfile=/run/maas-pserv.pid --logfile=/dev/null maas-pserv --config-file=/etc/maas/pserv.yaml
+env CONFIG_FILE=/etc/maas/maas_cluster.conf
+
+pre-start script
+    if [ ! -f $CONFIG_FILE ]; then
+        echo "$CONFIG_FILE does not exist.  Aborting."
+        stop
+        exit 0
+    fi
+end script
+
+script
+    # Prepare settings.
+    . $CONFIG_FILE
+    # To add options to your daemon, edit the line below:
+    exec /usr/bin/twistd -n --uid=maas --gid=maas --pidfile=/run/maas-pserv.pid --logfile=/dev/null maas-pserv --config-file=/etc/maas/pserv.yaml
+end script

=== modified file 'debian/maas-cluster-controller.postinst'
--- debian/maas-cluster-controller.postinst	2012-11-29 02:34:20 +0000
+++ debian/maas-cluster-controller.postinst	2012-12-12 12:53:47 +0000
@@ -26,6 +26,48 @@
 	ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
 }
 
+extract_cluster_uuid(){
+    # Extract ClUSTER_UUID setting from config file $1.  This will work
+    # both the cluster celery config (which is python) and the cluster
+    # config (which is shell).
+    local config_file="$1"
+    grep "^CLUSTER_UUID *= *[\"'][^\"']*[\"']" $config_file |
+        sed -e "s/^CLUSTER_UUID *= *\"\([^\"']*\)\".*/\1/"
+}
+
+configure_cluster_uuid(){
+    # The cluster uuid goes into maas_cluster.conf, but we also still
+    # keep a copy in maas_local_celeryconfig_cluster.py (hopefully just
+    # temporarily).  If an old uuid is configured, we replicate that to
+    # maas_cluster.conf; otherwise, we want to generate one.
+    local uuid
+
+
+    if [ -n "$(extract_cluster_uuid /etc/maas/maas_cluster.conf)" ]; then
+        # UUID is already set up.  Wonderful.
+        return
+    fi
+
+    # Look for a UUID stored in the old location.
+    uuid="$(extract_cluster_uuid /etc/maas/maas_local_celeryconfig_cluster.py)"
+
+    if [ -z "$uuid" ]; then
+        # No UUID at all yet.  Generate one, and insert it into its
+        # placeholder in the old config location.
+        uuid="$(uuidgen)"
+        sed -i "s|^CLUSTER_UUID = None$|CLUSTER_UUID = '$uuid'|" \
+            /etc/maas/maas_local_celeryconfig_cluster.py
+    fi
+
+    # Either way, at this point we have a uuid, and it is configured in
+    # the old config location.
+    #
+    # Write it to maas_cluster.conf as well.  There is no initial
+    # placeholder in this file, so just append the setting.
+    echo "CLUSTER_UUID=\"$uuid\"" >>/etc/maas/maas_cluster.conf
+}
+
+
 if [ "$1" = "configure" ] && [ -z "$2" ]; then
     # logging
     create_log_dir
@@ -35,13 +77,6 @@
     chown root:maas /etc/maas/maas_local_celeryconfig_cluster.py
     chmod 0640 /etc/maas/maas_local_celeryconfig_cluster.py
 
-    # Generate cluster UUID.
-    if grep -qs "^CLUSTER_UUID\ \= None$" /etc/maas/maas_local_celeryconfig_cluster.py; then
-        uuid="$(uuidgen)"
-        sed -i "s|^CLUSTER_UUID\ \= None$|CLUSTER_UUID = '"$uuid"'|" \
-                       /etc/maas/maas_local_celeryconfig_cluster.py
-    fi
-
     configure_maas_tgt
 fi
 
@@ -63,5 +98,9 @@
     fi
 fi
 
+if [ "$1" = "configure" ]; then
+    configure_cluster_uuid
+fi
+
 #DEBHELPER#
 exit 0


Follow ups