← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~andreserl/maas/update_maas_url_on_upgrade_precise.sru into lp:~maas-maintainers/maas/packaging.precise.sru

 

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

Commit message:
Update MAAS_URL on upgrade

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~andreserl/maas/update_maas_url_on_upgrade_precise.sru/+merge/143350
-- 
https://code.launchpad.net/~andreserl/maas/update_maas_url_on_upgrade_precise.sru/+merge/143350
Your team MAAS Maintainers is requested to review the proposed merge of lp:~andreserl/maas/update_maas_url_on_upgrade_precise.sru into lp:~maas-maintainers/maas/packaging.precise.sru.
=== modified file 'debian/changelog'
--- debian/changelog	2012-12-21 20:51:02 +0000
+++ debian/changelog	2013-01-15 16:42:16 +0000
@@ -51,6 +51,11 @@
   * Install maas-import-pxe-files and related files with maas-cluster-controller,
     as well as configure tgtd, as maas-region-controller no longer stores images.
     Thanks to Jeroen Vermuelen.
+  * 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.
 
   [ Gavin Panella ]
   * debian/extras/99-maas: squashfs image download is no longer needed.

=== modified file 'debian/maas-cluster-controller.postinst'
--- debian/maas-cluster-controller.postinst	2012-12-13 11:02:17 +0000
+++ debian/maas-cluster-controller.postinst	2013-01-15 16:42:16 +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