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
=== modified file 'debian/maas-cluster-controller.postinst'
--- debian/maas-cluster-controller.postinst 2013-07-18 14:14:21 +0000
+++ debian/maas-cluster-controller.postinst 2013-08-08 19:14:24 +0000
@@ -5,6 +5,8 @@
5. /usr/share/debconf/confmodule5. /usr/share/debconf/confmodule
6db_version 2.06db_version 2.0
77
8RELEASE=`lsb_release -rs` || RELEASE=""
9
8create_log_dir() {10create_log_dir() {
9 # create log dir11 # create log dir
10 if [ ! -d /var/lib/maas ]; then12 if [ ! -d /var/lib/maas ]; then
@@ -20,12 +22,12 @@
20}22}
2123
22configure_maas_tgt(){24configure_maas_tgt(){
23 # Set up iSCSI: add maas.conf to tgt conf.d.25 # Set up iSCSI: add maas.conf to tgt conf.d.
24 local tgtcfg="/etc/tgt/targets.conf"26 local tgtcfg="/etc/tgt/targets.conf"
25 [ -d /etc/tgt/conf.d/ ] || 27 [ -d /etc/tgt/conf.d/ ] ||
26 echo "Warning! $tgtcfg did not exist" 1>&2;28 echo "Warning! $tgtcfg did not exist" 1>&2;
27 mkdir -p /etc/tgt/conf.d/ /var/lib/maas/ephemeral/29 mkdir -p /etc/tgt/conf.d/ /var/lib/maas/ephemeral/
28 ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf30 ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
29}31}
3032
31extract_cluster_uuid(){33extract_cluster_uuid(){
@@ -68,11 +70,21 @@
68}70}
6971
70configure_cluster_http(){72configure_cluster_http(){
71 # handle apache configs73 case $RELEASE in
72 if [ -e /etc/maas/maas-cluster-http.conf -a \74 12.04|12.10|13.04)
73 ! -e /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then75 if [ -e /etc/maas/maas-cluster-http.conf -a \
74 ln -sf /etc/maas/maas-cluster-http.conf /etc/apache2/conf-enabled/maas-cluster-http.conf76 ! -e /etc/apache2/conf.d/maas-cluster-http.conf ]; then
75 fi77 ln -sf /etc/maas/maas-cluster-http.conf /etc/apache2/conf.d/maas-cluster-http.conf
78 fi
79 ;;
80 *)
81 # handle apache configs
82 if [ -e /etc/maas/maas-cluster-http.conf -a \
83 ! -e /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then
84 ln -sf /etc/maas/maas-cluster-http.conf /etc/apache2/conf-enabled/maas-cluster-http.conf
85 fi
86 ;;
87 esac
76}88}
7789
78restart_apache2(){90restart_apache2(){
7991
=== modified file 'debian/maas-cluster-controller.postrm'
--- debian/maas-cluster-controller.postrm 2013-07-18 14:14:21 +0000
+++ debian/maas-cluster-controller.postrm 2013-08-08 19:14:24 +0000
@@ -4,14 +4,25 @@
44
5#DEBHELPER#5#DEBHELPER#
66
7RELEASE=`lsb_release -rs` || RELEASE=""
8
7case "$1" in9case "$1" in
8 purge)10 purge)
9 # remove log directory11 # remove log directory
10 rm -rf /var/log/maas12 rm -rf /var/log/maas
11 # remove apache2 config13 case $RELEASE in
12 if [ -h /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then14 12.04|12.10|13.04)
13 rm -rf /etc/apache2/conf-enabled/maas-cluster-http.conf15 if [ -h /etc/apache2/conf.d/maas-cluster-http.conf ]; then
14 fi16 rm -rf /etc/apache2/conf.d/maas-cluster-http.conf
17 fi
18 ;;
19 *)
20 # remove apache2 config
21 if [ -h /etc/apache2/conf-enabled/maas-cluster-http.conf ]; then
22 rm -rf /etc/apache2/conf-enabled/maas-cluster-http.conf
23 fi
24 ;;
25 esac
15 # remove var directory26 # remove var directory
16 rm -rf /var/lib/maas/celerybeat-cluster-schedule27 rm -rf /var/lib/maas/celerybeat-cluster-schedule
17 DIR=/var/lib/maas28 DIR=/var/lib/maas
1829
=== modified file 'debian/maas-region-controller.postinst'
--- debian/maas-region-controller.postinst 2013-07-18 14:14:21 +0000
+++ debian/maas-region-controller.postinst 2013-08-08 19:14:24 +0000
@@ -9,6 +9,8 @@
9 . /usr/share/dbconfig-common/dpkg/postinst.pgsql9 . /usr/share/dbconfig-common/dpkg/postinst.pgsql
10fi10fi
1111
12RELEASE=`lsb_release -rs` || RELEASE=""
13
12maas_sync_migrate_db(){14maas_sync_migrate_db(){
13 maas syncdb --noinput15 maas syncdb --noinput
14 maas migrate maasserver --noinput16 maas migrate maasserver --noinput
@@ -27,6 +29,29 @@
27 invoke-rc.d squid-deb-proxy restart || true29 invoke-rc.d squid-deb-proxy restart || true
28}30}
2931
32configure_region_http() {
33 case $RELEASE in
34 12.04|12.10|13.04)
35 # handle apache configs
36 if [ -e /etc/maas/maas-http.conf -a \
37 ! -e /etc/apache2/conf.d/maas-http.conf ]; then
38 ln -sf /etc/maas/maas-http.conf /etc/apache2/conf.d/maas-http.conf
39 fi
40 ;;
41 *)
42 # handle apache configs
43 if [ -e /etc/maas/maas-http.conf -a \
44 ! -e /etc/apache2/conf-enabled/maas-http.conf ]; then
45 ln -sf /etc/maas/maas-http.conf /etc/apache2/conf-enabled/maas-http.conf
46 fi
47 ;;
48 esac
49 # enable apache modules needed
50 a2enmod proxy_http
51 a2enmod expires
52 a2enmod wsgi
53}
54
30configure_maas_txlongpoll_rabbitmq_user() {55configure_maas_txlongpoll_rabbitmq_user() {
31 local longpoll_user="maas_longpoll"56 local longpoll_user="maas_longpoll"
32 local longpoll_pass=57 local longpoll_pass=
@@ -127,16 +152,7 @@
127 #########################################################152 #########################################################
128 ################ Configure Apache2 ####################153 ################ Configure Apache2 ####################
129 #########################################################154 #########################################################
130 # handle apache configs155 configure_region_http
131 if [ -e /etc/maas/maas-http.conf -a \
132 ! -e /etc/apache2/conf-enabled/maas-http.conf ]; then
133 ln -sf /etc/maas/maas-http.conf /etc/apache2/conf-enabled/maas-http.conf
134 fi
135
136 # enable apache modules needed
137 a2enmod proxy_http
138 a2enmod expires
139 a2enmod wsgi
140156
141 #########################################################157 #########################################################
142 ########## Configure DEFAULT_MAAS_URL #################158 ########## Configure DEFAULT_MAAS_URL #################
@@ -234,6 +250,9 @@
234 # make sure postgresql is running250 # make sure postgresql is running
235 restart_postgresql251 restart_postgresql
236252
253 # make sure maas http config is symlinked
254 configure_region_http
255
237 # we need to regenerate the passwords and update configs.256 # we need to regenerate the passwords and update configs.
238 db_get maas/default-maas-url257 db_get maas/default-maas-url
239 ipaddr="$RET"258 ipaddr="$RET"
240259
=== modified file 'debian/maas-region-controller.postrm'
--- debian/maas-region-controller.postrm 2013-07-18 14:14:21 +0000
+++ debian/maas-region-controller.postrm 2013-08-08 19:14:24 +0000
@@ -4,6 +4,8 @@
44
5. /usr/share/debconf/confmodule5. /usr/share/debconf/confmodule
66
7RELEASE=`lsb_release -rs` || RELEASE=""
8
7if [ -f /etc/dbconfig-common/maas.conf ]; then9if [ -f /etc/dbconfig-common/maas.conf ]; then
8 if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then10 if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then
9 . /usr/share/dbconfig-common/dpkg/postrm.pgsql11 . /usr/share/dbconfig-common/dpkg/postrm.pgsql
@@ -15,9 +17,18 @@
15 purge)17 purge)
16 rm -rf /var/log/maas18 rm -rf /var/log/maas
17 rm -rf /var/lib/maas19 rm -rf /var/lib/maas
18 if [ -h /etc/apache2/conf-enabled/maas-http.conf ]; then20 case $RELEASE in
19 rm -rf /etc/apache2/conf-enabled/maas-http.conf21 12.04|12.10|13.04)
20 fi22 if [ -h /etc/apache2/conf.d/maas-http.conf ]; then
23 rm -rf /etc/apache2/conf.d/maas-http.conf
24 fi
25 ;;
26 *)
27 if [ -h /etc/apache2/conf-enabled/maas-http.conf ]; then
28 rm -rf /etc/apache2/conf-enabled/maas-http.conf
29 fi
30 ;;
31 esac
2132
22 # Restarting apache233 # Restarting apache2
23 if [ -x /usr/sbin/invoke-rc.d ]; then34 if [ -x /usr/sbin/invoke-rc.d ]; then

Subscribers

People subscribed via source and target branches

to all changes: