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

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: no longer in the source branch.
Merged at revision: 47
Proposed branch: lp:~andreserl/maas/packaging_updates_bzr473
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 311 lines (+143/-38)
5 files modified
debian/changelog (+21/-5)
debian/control (+1/-1)
debian/maas.config (+20/-9)
debian/maas.postinst (+87/-23)
debian/maas.templates (+14/-0)
To merge this branch: bzr merge lp:~andreserl/maas/packaging_updates_bzr473
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) Approve
Review via email: mp+102441@code.launchpad.net

Commit message

* New upstream release (Fixes LP: #981103)
  * debian/maas.postinst:
    - Make sure rabbitmq and postgresql are started on upgrade (LP: #981282)
    - Handle upgrades from any lower than 0.1+bzr462+dfsg-0ubuntu1 to
      correctly re-generate passwords, and not have db sync/migrate issues
      as config has changed upstream.
    - Correctly set Passwords for PSERV, otherwise it won't set new passwords.
  * Allow MAAS_DEFAULT_URL reconfiguration. (LP: #980970)
    - debian/maas.config: Add reconfigure validation to correctly allow it,
      and ask a question.
    - debian/maas.postinst: Reconfigure DEFAULT_MAAS_URL as well as cobbler
      server and next_server for PXE/Provisioning.
    - debian/maas.templates: Add debconf question and update info.
  * Do not lose MAAS_DEFAULT_URL settings on upgrade (LP: #984309)
  * debian/maas.postinst:
    - Set cobbler password in between quotes (LP: #984427)
    - Do not change permissions to maas.log (LP: #980915)

To post a comment you must log in.
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2012-04-13 13:56:10 +0000
+++ debian/changelog 2012-04-18 06:50:39 +0000
@@ -1,8 +1,24 @@
1maas (0.1+bzr462+dfsg-0ubuntu2) UNRELEASED; urgency=low1maas (0.1+bzr473+dfsg-0ubuntu1) UNRELEASED; urgency=low
22
3 * UNRELEASED3 * New upstream release (Fixes LP: #981103)
44 * debian/maas.postinst:
5 -- Andres Rodriguez <andreserl@ubuntu.com> Fri, 13 Apr 2012 09:55:41 -04005 - Make sure rabbitmq and postgresql are started on upgrade (LP: #981282)
6 - Handle upgrades from any lower than 0.1+bzr462+dfsg-0ubuntu1 to
7 correctly re-generate passwords, and not have db sync/migrate issues
8 as config has changed upstream.
9 - Correctly set Passwords for PSERV, otherwise it won't set new passwords.
10 * Allow MAAS_DEFAULT_URL reconfiguration. (LP: #980970)
11 - debian/maas.config: Add reconfigure validation to correctly allow it,
12 and ask a question.
13 - debian/maas.postinst: Reconfigure DEFAULT_MAAS_URL as well as cobbler
14 server and next_server for PXE/Provisioning.
15 - debian/maas.templates: Add debconf question and update info.
16 * Do not lose MAAS_DEFAULT_URL settings on upgrade (LP: #984309)
17 * debian/maas.postinst:
18 - Set cobbler password in between quotes (LP: #984427)
19 - Do not change permissions to maas.log (LP: #980915)
20
21 -- Andres Rodriguez <andreserl@ubuntu.com> Tue, 17 Apr 2012 23:44:46 -0700
622
7maas (0.1+bzr462+dfsg-0ubuntu1) precise; urgency=low23maas (0.1+bzr462+dfsg-0ubuntu1) precise; urgency=low
824
925
=== modified file 'debian/control'
--- debian/control 2012-04-11 00:11:53 +0000
+++ debian/control 2012-04-18 06:50:39 +0000
@@ -11,7 +11,7 @@
11Architecture: all11Architecture: all
12Depends: apache2,12Depends: apache2,
13 avahi-daemon,13 avahi-daemon,
14 cobbler,14 maas-provision (>= 2.2.2),
15 dbconfig-common,15 dbconfig-common,
16 distro-info,16 distro-info,
17 libapache2-mod-wsgi,17 libapache2-mod-wsgi,
1818
=== modified file 'debian/maas.config'
--- debian/maas.config 2012-04-10 19:26:20 +0000
+++ debian/maas.config 2012-04-18 06:50:39 +0000
@@ -5,15 +5,15 @@
55
6# creates question6# creates question
7set_question() {7set_question() {
8 if ! db_fget "$1" seen; then8 if ! db_fget "$1" seen; then
9 db_register dbconfig-common/dbconfig-install "$1"9 db_register dbconfig-common/dbconfig-install "$1"
10 db_subst "$1" ID "$1"10 db_subst "$1" ID "$1"
11 db_fget "$1" seen11 db_fget "$1" seen
12 fi12 fi
13 if [ "$RET" = false ]; then13 if [ "$RET" = false ]; then
14 db_set "$1" "$2"14 db_set "$1" "$2"
15 db_fset "$1" seen true15 db_fset "$1" seen true
16 fi16 fi
17}17}
1818
19# source dbconfig-common shell library, and call the hook function19# source dbconfig-common shell library, and call the hook function
@@ -30,4 +30,15 @@
30 set_question maas/dbconfig-install true30 set_question maas/dbconfig-install true
31 set_question maas/pgsql/app-pass ""31 set_question maas/pgsql/app-pass ""
32 dbc_go maas $@32 dbc_go maas $@
33
34elif [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
35 db_get maas/default-maas-url || true
36 if [ -n "$RET" ]; then
37 db_set maas/default-maas-url "$RET"
38 else
39 ipaddr=$(awk '$1 == "DEFAULT_MAAS_URL" { split($0,array,"/")} END{print array[3] }' /etc/maas/maas_local_settings.py)
40 db_set maas/default-maas-url "$ipaddr"
41 fi
42 db_input low maas/default-maas-url || true
43 db_go
33fi44fi
3445
=== modified file 'debian/maas.postinst'
--- debian/maas.postinst 2012-04-12 17:53:35 +0000
+++ debian/maas.postinst 2012-04-18 06:50:39 +0000
@@ -21,6 +21,30 @@
21 fi21 fi
22}22}
2323
24restart_rabbitmq(){
25 if [ -x /usr/sbin/invoke-rc.d ]; then
26 invoke-rc.d rabbitmq-server restart || true
27 else
28 /etc/init.d/rabbitmq-server restart || true
29 fi
30}
31
32restart_postgresql(){
33 if [ -x /usr/sbin/invoke-rc.d ]; then
34 invoke-rc.d --force postgresql restart || true
35 else
36 /etc/init.d/postgresql restart || true
37 fi
38}
39
40restart_cobbler(){
41 if [ -x /usr/sbin/invoke-rc.d ]; then
42 invoke-rc.d cobbler restart || true
43 else
44 /etc/init.d/cobbler restart || true
45 fi
46}
47
24add_user_group(){48add_user_group(){
25 local user="maas"49 local user="maas"
26 local group="maas"50 local group="maas"
@@ -46,19 +70,19 @@
46 htpasswd -D /etc/cobbler/users.digest "maas" || true70 htpasswd -D /etc/cobbler/users.digest "maas" || true
47 printf "maas:Cobbler:$hash\n" >> /etc/cobbler/users.digest71 printf "maas:Cobbler:$hash\n" >> /etc/cobbler/users.digest
4872
49 if grep -qs "^\ \{1,\}password: [a-zA-Z0-9]\{1,\}$" /etc/maas/pserv.yaml; then73 if grep -qs "^\ \{1,\}password:.*$" /etc/maas/pserv.yaml; then
50 sed -i "s/^\ \{1,\}password: [a-zA-Z0-9]\{1,\}$/ password: "$cblr_pass"/" /etc/maas/pserv.yaml74 sed -i "s/^\ \{1,\}password:.*$/ password: \""$cblr_pass"\"/" /etc/maas/pserv.yaml
51 fi75 fi
52}76}
5377
54configure_maas_pserv_user() {78configure_maas_pserv_user() {
55 local pserv_pass=79 local pserv_pass=
56 pserv_pass="$(pwgen -s 20)"80 pserv_pass="$(pwgen -s 20)"
57 if grep -qs "^password: \"test\"" /etc/maas/pserv.yaml; then81 if grep -qs "^password: \".*\"$" /etc/maas/pserv.yaml; then
58 sed -i '/^password:/s/"test"/"'"${pserv_pass}"'"/' /etc/maas/pserv.yaml82 sed -i '/^password:/s/".*"$/"'"${pserv_pass}"'"/' /etc/maas/pserv.yaml
59 fi83 fi
60 if grep -qs "^PSERV_URL\ =\ " /etc/maas/maas_local_settings.py; then84 if grep -qs "^PSERV_URL\ =\ " /etc/maas/maas_local_settings.py; then
61 sed -i '/^PSERV_URL[ =]/s/:password@/:'"${pserv_pass}"'@/' /etc/maas/maas_local_settings.py85 sed -i '/^PSERV_URL[ =]/s/maas:.*@/'"maas:${pserv_pass}"'@/' /etc/maas/maas_local_settings.py
62 fi86 fi
63}87}
6488
@@ -103,6 +127,23 @@
103 ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf127 ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
104}128}
105129
130configure_maas_default_url() {
131 local ipaddr="$1"
132
133 if grep -qs "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py; then
134 sed -i "s/^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$/DEFAULT_MAAS_URL = \"http:\/\/"$ipaddr"\/\"/" \
135 /etc/maas/maas_local_settings.py
136 fi
137
138 # Replace for PXE
139 if grep -qs "^next_server:.*$" /etc/cobbler/settings; then
140 sed -i "s/^next_server:.*$/next_server: $ipaddr/" /etc/cobbler/settings
141 fi
142 if grep -qs "^server:.*$" /etc/cobbler/settings; then
143 sed -i "s/^server:.*$/server: $ipaddr/" /etc/cobbler/settings
144 fi
145}
146
106if [ "$1" = "configure" ] && [ -z "$2" ]; then147if [ "$1" = "configure" ] && [ -z "$2" ]; then
107 #########################################################148 #########################################################
108 ################ User/Group Creatiion ##################149 ################ User/Group Creatiion ##################
@@ -157,11 +198,9 @@
157 ipaddr=${ipaddr%%/*}198 ipaddr=${ipaddr%%/*}
158 # Set the IP address of the interface with default route199 # Set the IP address of the interface with default route
159 if [ -n "$ipaddr" ]; then200 if [ -n "$ipaddr" ]; then
160 if grep -qs "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py; then201 configure_maas_default_url "$ipaddr"
161 sed -i "s/^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$/DEFAULT_MAAS_URL = \"http:\/\/"$ipaddr"\/\"/" \
162 /etc/maas/maas_local_settings.py
163 fi
164 db_subst maas/installation-note MAAS_URL "$ipaddr"202 db_subst maas/installation-note MAAS_URL "$ipaddr"
203 db_set maas/default-maas-url "$ipaddr"
165 fi204 fi
166205
167 #########################################################206 #########################################################
@@ -173,7 +212,6 @@
173 touch /var/log/maas/maas.log212 touch /var/log/maas/maas.log
174 fi213 fi
175 chown -R maas:maas /var/log/maas214 chown -R maas:maas /var/log/maas
176 chmod 620 /var/log/maas/maas.log
177 chmod -R 775 /var/log/maas/oops215 chmod -R 775 /var/log/maas/oops
178216
179 # Create log directory base217 # Create log directory base
@@ -197,11 +235,7 @@
197 #########################################################235 #########################################################
198236
199 # Handle longpoll/rabbitmq publishing237 # Handle longpoll/rabbitmq publishing
200 if [ -x /usr/sbin/invoke-rc.d ]; then238 restart_rabbitmq
201 invoke-rc.d rabbitmq-server restart || true
202 else
203 /etc/init.d/rabbitmq-server restart || true
204 fi
205 configure_maas_txlongpoll_rabbitmq_user239 configure_maas_txlongpoll_rabbitmq_user
206240
207 #########################################################241 #########################################################
@@ -214,11 +248,7 @@
214 #########################################################248 #########################################################
215249
216 # Need to for postgresql start so it doesn't fail on the installer250 # Need to for postgresql start so it doesn't fail on the installer
217 if [ -x /usr/sbin/invoke-rc.d ]; then251 restart_postgresql
218 invoke-rc.d --force postgresql restart || true
219 else
220 /etc/init.d/postgresql restart || true
221 fi
222252
223 # Create the database253 # Create the database
224 dbc_go maas $@254 dbc_go maas $@
@@ -234,28 +264,62 @@
234 db_input high maas/installation-note || true264 db_input high maas/installation-note || true
235 db_go265 db_go
236266
267elif [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
268 # Set the IP address of the interface with default route
269 db_get maas/default-maas-url
270 ipaddr="$RET"
271 db_set maas/default-maas-url "$ipaddr"
272 if [ -n "$ipaddr" ]; then
273 configure_maas_default_url "$ipaddr"
274 fi
275 restart_cobbler
276
237elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then277elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then
238 # If upgrading to any later package version, then upgrade db.278 # If upgrading to any later package version, then upgrade db.
239 if [ -x /usr/sbin/invoke-rc.d ]; then279 if [ -x /usr/sbin/invoke-rc.d ]; then
240 invoke-rc.d apache2 stop || true280 invoke-rc.d apache2 stop || true
241 fi281 fi
242282
283 # make sure postgresql is running
284 restart_postgresql
285
243 # If upgrading from any version lower than 0.1+bzr445+dfsg-0ubuntu1286 # If upgrading from any version lower than 0.1+bzr445+dfsg-0ubuntu1
244 # we need to update the user/group.287 # we need to update the user/group.
245 if dpkg --compare-versions "$2" lt 0.1+bzr445+dfsg-0ubuntu1; then288 if dpkg --compare-versions "$2" lt 0.1+bzr445+dfsg-0ubuntu1; then
289 # add user/group
246 add_user_group290 add_user_group
291 # set correct permissions
247 chown -R maas:maas /var/lib/maas/292 chown -R maas:maas /var/lib/maas/
248 chown -R maas:maas /var/log/maas293 chown -R maas:maas /var/log/maas
249 chown -R syslog:syslog /var/log/maas/rsyslog294 chown -R syslog:syslog /var/log/maas/rsyslog
295 fi
296 if dpkg --compare-versions "$2" lt 0.1+bzr459+dfsg-0ubuntu1; then
297 configure_maas_tgt
298 fi
299 # If upgrading from any version lower than 0.1+bzr462+dfsg-0ubuntu1
300 # we need to regenerate the passwords and update configs.
301 if dpkg --compare-versions "$2" lt 0.1+bzr473+dfsg-0ubuntu1; then
302 # configure maas user for cobbler
250 configure_maas_cobbler_user303 configure_maas_cobbler_user
304 # configure pserv user for cobbler
251 configure_maas_pserv_user305 configure_maas_pserv_user
306 # configure maas default url
307 db_get maas/default-maas-url
308 ipaddr="$RET"
309 # If nothing in the database, obtain the IP from cobbler settings
310 # which is the same as MAAS_DEFAULT_URL
311 if [ -z "$ipaddr" ]; then
312 ipaddr=$(awk '$1 == "server:" { print $2 }' /etc/cobbler/settings)
313 db_set maas/default-maas-url "$ipaddr"
314 fi
315 configure_maas_default_url "$ipaddr"
316 # make sure rabbitmq is running
317 restart_rabbitmq
252 configure_maas_txlongpoll_rabbitmq_user318 configure_maas_txlongpoll_rabbitmq_user
319 # handle database upgrade
253 dbc_go maas $@320 dbc_go maas $@
254 configure_maas_database "$dbc_dbpass"321 configure_maas_database "$dbc_dbpass"
255 fi322 fi
256 if dpkg --compare-versions "$2" lt 0.1+bzr459+dfsg-0ubuntu1; then
257 configure_maas_tgt
258 fi
259323
260 maas_sync_migrate_db324 maas_sync_migrate_db
261 restart_apache2325 restart_apache2
262326
=== modified file 'debian/maas.templates'
--- debian/maas.templates 2012-04-04 18:52:33 +0000
+++ debian/maas.templates 2012-04-18 06:50:39 +0000
@@ -6,3 +6,17 @@
6 can access the MAAS Web interface here:6 can access the MAAS Web interface here:
7 .7 .
8 http://${MAAS_URL}/MAAS8 http://${MAAS_URL}/MAAS
9 .
10 If the automatically detected address above is not in the same
11 network as the MAAS clients, you need to reconfigure it:
12 .
13 sudo dpkg-reconfigure maas
14
15Template: maas/default-maas-url
16Type: string
17_Description: Ubuntu MAAS PXE/Provisioning network address:
18 The Ubuntu MAAS Server automatically detects the IP address
19 that is used for PXE and provisioning. However, it needs to be
20 in the same network as the clients. If the automatically
21 detected address is not in the same network as the clients, it
22 must be changed.

Subscribers

People subscribed via source and target branches

to all changes: