← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~andreserl/maas/packaging_default_url_preseed/+merge/195074
-- 
https://code.launchpad.net/~andreserl/maas/packaging_default_url_preseed/+merge/195074
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~andreserl/maas/packaging_default_url_preseed into lp:~maas-maintainers/maas/packaging.
=== modified file 'debian/changelog'
--- debian/changelog	2013-10-11 14:14:57 +0000
+++ debian/changelog	2013-11-13 14:58:15 +0000
@@ -5,6 +5,10 @@
   [ Jeroen Vermeulen ]
   * Keep legacy import_ephemerals config for now.
 
+  [ Andres Rodriguez ]
+  * debian/maas-region-controller.postinst: Allo default-maas-url debconf
+    option to be preseeded.
+
  -- Andres Rodriguez <andreserl@xxxxxxxxxx>  Thu, 10 Oct 2013 17:07:51 -0400
 
 maas (1.4+bzr1693+dfsg-0ubuntu1) saucy; urgency=low

=== modified file 'debian/maas-region-controller.postinst'
--- debian/maas-region-controller.postinst	2013-08-08 19:14:07 +0000
+++ debian/maas-region-controller.postinst	2013-11-13 14:58:15 +0000
@@ -120,6 +120,17 @@
 	fi
 }
 
+get_default_route_ip() {
+	while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
+		[ "$Mask" = "00000000" ] && break
+	done < /proc/net/route
+	interface="$Iface"
+	ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global)
+	ipaddr=${ipaddr#* inet }
+	ipaddr=${ipaddr%%/*}
+        echo $ipaddr
+}
+
 configure_maas_squid_deb_proxy() {
 	local ipaddr="$1"
 
@@ -159,13 +170,11 @@
 	#########################################################
 
 	# Obtain IP address of default route and change DEFAULT_MAAS_URL.
-	while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
-		[ "$Mask" = "00000000" ] && break
-	done < /proc/net/route
-	interface="$Iface"
-	ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global)
-	ipaddr=${ipaddr#* inet }
-	ipaddr=${ipaddr%%/*}
+	db_get maas/default-maas-url
+	ipaddr="$RET"
+	if [ -z "$RET" ]; then
+		ipaddr=$(get_default_route_ip)
+	fi
 	# Set the IP address of the interface with default route
 	if [ -n "$ipaddr" ]; then
 		configure_maas_default_url "$ipaddr"