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

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: 198
Merged at revision: 197
Proposed branch: lp:~andreserl/maas/maas_fix_apache2_configs
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 198 lines (+81/-28)
4 files modified
debian/maas-cluster-controller.postinst (+23/-11)
debian/maas-cluster-controller.postrm (+15/-4)
debian/maas-region-controller.postinst (+29/-10)
debian/maas-region-controller.postrm (+14/-3)
To merge this branch: bzr merge lp:~andreserl/maas/maas_fix_apache2_configs
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+177464@code.launchpad.net

Commit message

Fix postinst configuration to handle both apache2.2 and apache2.4 config style.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

41 + case $RELEASE in
42 + 12.04|12.10|13.04)

FYI I was previously told to use code names and not release names in packaging.

There is another bug you might have to fix as well - I recently upgraded from an older saucy before the apache conf change happened, and after the upgrade my apache conf was still in the wrong place.

Everything else looks ok to me, thanks for the fix!

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

Hi Julian,
So Sorry for the delay. I somehow missed this. I have made the changes to handle the upgrades for the region.

As far as the 12.04, 12.10, etc, I saw other postinst scripts doing it so I went forward to using it.

CHeers.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Looks good, land it!

Revision history for this message
MAAS Lander (maas-lander) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/maas-cluster-controller.postinst'
2--- debian/maas-cluster-controller.postinst 2013-07-18 14:14:21 +0000
3+++ debian/maas-cluster-controller.postinst 2013-08-08 19:14:24 +0000
4@@ -5,6 +5,8 @@
5 . /usr/share/debconf/confmodule
6 db_version 2.0
7
8+RELEASE=`lsb_release -rs` || RELEASE=""
9+
10 create_log_dir() {
11 # create log dir
12 if [ ! -d /var/lib/maas ]; then
13@@ -20,12 +22,12 @@
14 }
15
16 configure_maas_tgt(){
17- # Set up iSCSI: add maas.conf to tgt conf.d.
18- local tgtcfg="/etc/tgt/targets.conf"
19- [ -d /etc/tgt/conf.d/ ] ||
20- echo "Warning! $tgtcfg did not exist" 1>&2;
21- mkdir -p /etc/tgt/conf.d/ /var/lib/maas/ephemeral/
22- ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
23+ # Set up iSCSI: add maas.conf to tgt conf.d.
24+ local tgtcfg="/etc/tgt/targets.conf"
25+ [ -d /etc/tgt/conf.d/ ] ||
26+ echo "Warning! $tgtcfg did not exist" 1>&2;
27+ mkdir -p /etc/tgt/conf.d/ /var/lib/maas/ephemeral/
28+ ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
29 }
30
31 extract_cluster_uuid(){
32@@ -68,11 +70,21 @@
33 }
34
35 configure_cluster_http(){
36- # handle apache configs
37- if [ -e /etc/maas/maas-cluster-http.conf -a \
38- ! -e /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then
39- ln -sf /etc/maas/maas-cluster-http.conf /etc/apache2/conf-enabled/maas-cluster-http.conf
40- fi
41+ case $RELEASE in
42+ 12.04|12.10|13.04)
43+ if [ -e /etc/maas/maas-cluster-http.conf -a \
44+ ! -e /etc/apache2/conf.d/maas-cluster-http.conf ]; then
45+ ln -sf /etc/maas/maas-cluster-http.conf /etc/apache2/conf.d/maas-cluster-http.conf
46+ fi
47+ ;;
48+ *)
49+ # handle apache configs
50+ if [ -e /etc/maas/maas-cluster-http.conf -a \
51+ ! -e /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then
52+ ln -sf /etc/maas/maas-cluster-http.conf /etc/apache2/conf-enabled/maas-cluster-http.conf
53+ fi
54+ ;;
55+ esac
56 }
57
58 restart_apache2(){
59
60=== modified file 'debian/maas-cluster-controller.postrm'
61--- debian/maas-cluster-controller.postrm 2013-07-18 14:14:21 +0000
62+++ debian/maas-cluster-controller.postrm 2013-08-08 19:14:24 +0000
63@@ -4,14 +4,25 @@
64
65 #DEBHELPER#
66
67+RELEASE=`lsb_release -rs` || RELEASE=""
68+
69 case "$1" in
70 purge)
71 # remove log directory
72 rm -rf /var/log/maas
73- # remove apache2 config
74- if [ -h /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then
75- rm -rf /etc/apache2/conf-enabled/maas-cluster-http.conf
76- fi
77+ case $RELEASE in
78+ 12.04|12.10|13.04)
79+ if [ -h /etc/apache2/conf.d/maas-cluster-http.conf ]; then
80+ rm -rf /etc/apache2/conf.d/maas-cluster-http.conf
81+ fi
82+ ;;
83+ *)
84+ # remove apache2 config
85+ if [ -h /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then
86+ rm -rf /etc/apache2/conf-enabled/maas-cluster-http.conf
87+ fi
88+ ;;
89+ esac
90 # remove var directory
91 rm -rf /var/lib/maas/celerybeat-cluster-schedule
92 DIR=/var/lib/maas
93
94=== modified file 'debian/maas-region-controller.postinst'
95--- debian/maas-region-controller.postinst 2013-07-18 14:14:21 +0000
96+++ debian/maas-region-controller.postinst 2013-08-08 19:14:24 +0000
97@@ -9,6 +9,8 @@
98 . /usr/share/dbconfig-common/dpkg/postinst.pgsql
99 fi
100
101+RELEASE=`lsb_release -rs` || RELEASE=""
102+
103 maas_sync_migrate_db(){
104 maas syncdb --noinput
105 maas migrate maasserver --noinput
106@@ -27,6 +29,29 @@
107 invoke-rc.d squid-deb-proxy restart || true
108 }
109
110+configure_region_http() {
111+ case $RELEASE in
112+ 12.04|12.10|13.04)
113+ # handle apache configs
114+ if [ -e /etc/maas/maas-http.conf -a \
115+ ! -e /etc/apache2/conf.d/maas-http.conf ]; then
116+ ln -sf /etc/maas/maas-http.conf /etc/apache2/conf.d/maas-http.conf
117+ fi
118+ ;;
119+ *)
120+ # handle apache configs
121+ if [ -e /etc/maas/maas-http.conf -a \
122+ ! -e /etc/apache2/conf-enabled/maas-http.conf ]; then
123+ ln -sf /etc/maas/maas-http.conf /etc/apache2/conf-enabled/maas-http.conf
124+ fi
125+ ;;
126+ esac
127+ # enable apache modules needed
128+ a2enmod proxy_http
129+ a2enmod expires
130+ a2enmod wsgi
131+}
132+
133 configure_maas_txlongpoll_rabbitmq_user() {
134 local longpoll_user="maas_longpoll"
135 local longpoll_pass=
136@@ -127,16 +152,7 @@
137 #########################################################
138 ################ Configure Apache2 ####################
139 #########################################################
140- # handle apache configs
141- if [ -e /etc/maas/maas-http.conf -a \
142- ! -e /etc/apache2/conf-enabled/maas-http.conf ]; then
143- ln -sf /etc/maas/maas-http.conf /etc/apache2/conf-enabled/maas-http.conf
144- fi
145-
146- # enable apache modules needed
147- a2enmod proxy_http
148- a2enmod expires
149- a2enmod wsgi
150+ configure_region_http
151
152 #########################################################
153 ########## Configure DEFAULT_MAAS_URL #################
154@@ -234,6 +250,9 @@
155 # make sure postgresql is running
156 restart_postgresql
157
158+ # make sure maas http config is symlinked
159+ configure_region_http
160+
161 # we need to regenerate the passwords and update configs.
162 db_get maas/default-maas-url
163 ipaddr="$RET"
164
165=== modified file 'debian/maas-region-controller.postrm'
166--- debian/maas-region-controller.postrm 2013-07-18 14:14:21 +0000
167+++ debian/maas-region-controller.postrm 2013-08-08 19:14:24 +0000
168@@ -4,6 +4,8 @@
169
170 . /usr/share/debconf/confmodule
171
172+RELEASE=`lsb_release -rs` || RELEASE=""
173+
174 if [ -f /etc/dbconfig-common/maas.conf ]; then
175 if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
176 . /usr/share/dbconfig-common/dpkg/postrm.pgsql
177@@ -15,9 +17,18 @@
178 purge)
179 rm -rf /var/log/maas
180 rm -rf /var/lib/maas
181- if [ -h /etc/apache2/conf-enabled/maas-http.conf ]; then
182- rm -rf /etc/apache2/conf-enabled/maas-http.conf
183- fi
184+ case $RELEASE in
185+ 12.04|12.10|13.04)
186+ if [ -h /etc/apache2/conf.d/maas-http.conf ]; then
187+ rm -rf /etc/apache2/conf.d/maas-http.conf
188+ fi
189+ ;;
190+ *)
191+ if [ -h /etc/apache2/conf-enabled/maas-http.conf ]; then
192+ rm -rf /etc/apache2/conf-enabled/maas-http.conf
193+ fi
194+ ;;
195+ esac
196
197 # Restarting apache2
198 if [ -x /usr/sbin/invoke-rc.d ]; then

Subscribers

People subscribed via source and target branches

to all changes: