← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/update_maas_url_on_upgrade_raring into lp:~maas-maintainers/maas/packaging

 

Andres Rodriguez has proposed merging lp:~andreserl/maas/update_maas_url_on_upgrade_raring into lp:~maas-maintainers/maas/packaging.

Commit message:
Update MAAS_URL on upgrade

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andreserl/maas/update_maas_url_on_upgrade_raring/+merge/143352
-- 
https://code.launchpad.net/~andreserl/maas/update_maas_url_on_upgrade_raring/+merge/143352
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/update_maas_url_on_upgrade_raring into lp:~maas-maintainers/maas/packaging.
=== modified file 'debian/changelog'
--- debian/changelog	2012-12-19 05:33:07 +0000
+++ debian/changelog	2013-01-15 16:43:44 +0000
@@ -54,6 +54,11 @@
   * debian/maas-cluster-controller.config: If URL has been detected, add /MAAS if
     it doesn't contain it. This helps upgrades from versions where DEFAULT_MAAS_URL
     didn't use /MAAS.
+  * debian/maas-cluster-controller.postinst:
+    - If MAAS_URL has not been set in debconf db, and cluster is installed
+      the region controller, obtain it from DEFAULT_MAAS_URL.
+    - Update MAAS_URL (etc/maas/maas_cluster.conf) on upgrades. PXE will end up
+      being broken.
 
  -- Julian Edwards <julian.edwards@xxxxxxxxxxxxx>  Thu, 22 Nov 2012 17:26:15 +1000
 

=== modified file 'debian/maas-cluster-controller.postinst'
--- debian/maas-cluster-controller.postinst	2012-12-13 10:05:52 +0000
+++ debian/maas-cluster-controller.postinst	2013-01-15 16:43:44 +0000
@@ -65,19 +65,7 @@
     echo "CLUSTER_UUID=\"$uuid\"" >>/etc/maas/maas_cluster.conf
 }
 
-
-if [ "$1" = "configure" ] && [ -z "$2" ]; then
-    # logging
-    create_log_dir
-    configure_maas_tgt
-fi
-
-if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
-
-    if dpkg --compare-versions "$2" lt 0.1+bzr1239+dfsg-0ubuntu1; then
-        create_log_dir
-    fi
-
+configure_maas_url () {
     # Get the MAAS_URL on configure/reconfigure and write it to the conf files.
     db_get maas-cluster-controller/maas-url || true
     if [ -n "$RET" ]; then
@@ -87,7 +75,28 @@
         # And substitute it in-place in pserv.yaml on an indented, non-commented
         # line.
         sed -ri "s|^([[:space:]]+)(#+[[:space:]]*)?(generator:[[:space:]]+https?://)[^:/]+|\1\3$HOSTPART|" /etc/maas/pserv.yaml
-    fi
+    elif dpkg -s maas-region-controller >/dev/null 2>&1; then
+        # If maas-region-controller is inslalled in the same machine, we update
+        # MAAS_URL with DEFAULT_MAAS_URL value. Otherwise url attribute on PXE's
+        # kernel command line will be broken.
+        maas_url=$(grep "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py | cut -d'"' -f2)
+        sed -i "s|MAAS_URL=.*|MAAS_URL="$maas_url"|" /etc/maas/maas_cluster.conf
+    fi
+}
+
+
+if [ "$1" = "configure" ] && [ -z "$2" ]; then
+    # logging
+    create_log_dir
+    configure_maas_tgt
+fi
+
+if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
+
+    if dpkg --compare-versions "$2" lt 0.1+bzr1239+dfsg-0ubuntu1; then
+        create_log_dir
+    fi
+
 fi
 
 if [ "$1" = "configure" ]; then
@@ -101,6 +110,7 @@
         /etc/maas/maas_cluster.conf
 
     configure_cluster_uuid
+    configure_maas_url
 fi
 
 #DEBHELPER#


Follow ups