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

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: 214
Merged at revision: 213
Proposed branch: lp:~andreserl/maas/packaging_default_url_preseed
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 58 lines (+22/-8)
2 files modified
debian/changelog (+4/-0)
debian/maas-region-controller.postinst (+18/-8)
To merge this branch: bzr merge lp:~andreserl/maas/packaging_default_url_preseed
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Diogo Matsubara (community) Approve
Review via email: mp+195074@code.launchpad.net

Commit message

debian/maas-region-controller.postinst: Allo default-maas-url debconf
option to be preseeded.

To post a comment you must log in.
Revision history for this message
Diogo Matsubara (matsubara) wrote :

Looks good to me. The only additional thing I'd do is to update the comment to explain that we use the preseeded value if it's there, if not we use the default route one.

review: Approve
214. By Andres Rodriguez

update

Revision history for this message
Andres Rodriguez (andreserl) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-10-11 14:14:57 +0000
3+++ debian/changelog 2013-11-13 15:08:45 +0000
4@@ -5,6 +5,10 @@
5 [ Jeroen Vermeulen ]
6 * Keep legacy import_ephemerals config for now.
7
8+ [ Andres Rodriguez ]
9+ * debian/maas-region-controller.postinst: Allo default-maas-url debconf
10+ option to be preseeded.
11+
12 -- Andres Rodriguez <andreserl@ubuntu.com> Thu, 10 Oct 2013 17:07:51 -0400
13
14 maas (1.4+bzr1693+dfsg-0ubuntu1) saucy; urgency=low
15
16=== modified file 'debian/maas-region-controller.postinst'
17--- debian/maas-region-controller.postinst 2013-08-08 19:14:07 +0000
18+++ debian/maas-region-controller.postinst 2013-11-13 15:08:45 +0000
19@@ -120,6 +120,17 @@
20 fi
21 }
22
23+get_default_route_ip() {
24+ while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
25+ [ "$Mask" = "00000000" ] && break
26+ done < /proc/net/route
27+ interface="$Iface"
28+ ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global)
29+ ipaddr=${ipaddr#* inet }
30+ ipaddr=${ipaddr%%/*}
31+ echo $ipaddr
32+}
33+
34 configure_maas_squid_deb_proxy() {
35 local ipaddr="$1"
36
37@@ -158,14 +169,13 @@
38 ########## Configure DEFAULT_MAAS_URL #################
39 #########################################################
40
41- # Obtain IP address of default route and change DEFAULT_MAAS_URL.
42- while read Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT; do
43- [ "$Mask" = "00000000" ] && break
44- done < /proc/net/route
45- interface="$Iface"
46- ipaddr=$(LC_ALL=C /sbin/ip -4 addr list dev "$interface" scope global)
47- ipaddr=${ipaddr#* inet }
48- ipaddr=${ipaddr%%/*}
49+ # Obtain IP address of default route and change DEFAULT_MAAS_URL
50+ # if default-maas-url has not been preseeded.
51+ db_get maas/default-maas-url
52+ ipaddr="$RET"
53+ if [ -z "$RET" ]; then
54+ ipaddr=$(get_default_route_ip)
55+ fi
56 # Set the IP address of the interface with default route
57 if [ -n "$ipaddr" ]; then
58 configure_maas_default_url "$ipaddr"

Subscribers

People subscribed via source and target branches

to all changes: