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

Proposed by Andres Rodriguez on 2012-04-18
Status: Merged
Approved by: Andres Rodriguez on 2012-04-18
Approved revision: 51
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) 2012-04-18 Approve on 2012-04-18
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.
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
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-04-13 13:56:10 +0000
3+++ debian/changelog 2012-04-18 06:50:39 +0000
4@@ -1,8 +1,24 @@
5-maas (0.1+bzr462+dfsg-0ubuntu2) UNRELEASED; urgency=low
6-
7- * UNRELEASED
8-
9- -- Andres Rodriguez <andreserl@ubuntu.com> Fri, 13 Apr 2012 09:55:41 -0400
10+maas (0.1+bzr473+dfsg-0ubuntu1) UNRELEASED; urgency=low
11+
12+ * New upstream release (Fixes LP: #981103)
13+ * debian/maas.postinst:
14+ - Make sure rabbitmq and postgresql are started on upgrade (LP: #981282)
15+ - Handle upgrades from any lower than 0.1+bzr462+dfsg-0ubuntu1 to
16+ correctly re-generate passwords, and not have db sync/migrate issues
17+ as config has changed upstream.
18+ - Correctly set Passwords for PSERV, otherwise it won't set new passwords.
19+ * Allow MAAS_DEFAULT_URL reconfiguration. (LP: #980970)
20+ - debian/maas.config: Add reconfigure validation to correctly allow it,
21+ and ask a question.
22+ - debian/maas.postinst: Reconfigure DEFAULT_MAAS_URL as well as cobbler
23+ server and next_server for PXE/Provisioning.
24+ - debian/maas.templates: Add debconf question and update info.
25+ * Do not lose MAAS_DEFAULT_URL settings on upgrade (LP: #984309)
26+ * debian/maas.postinst:
27+ - Set cobbler password in between quotes (LP: #984427)
28+ - Do not change permissions to maas.log (LP: #980915)
29+
30+ -- Andres Rodriguez <andreserl@ubuntu.com> Tue, 17 Apr 2012 23:44:46 -0700
31
32 maas (0.1+bzr462+dfsg-0ubuntu1) precise; urgency=low
33
34
35=== modified file 'debian/control'
36--- debian/control 2012-04-11 00:11:53 +0000
37+++ debian/control 2012-04-18 06:50:39 +0000
38@@ -11,7 +11,7 @@
39 Architecture: all
40 Depends: apache2,
41 avahi-daemon,
42- cobbler,
43+ maas-provision (>= 2.2.2),
44 dbconfig-common,
45 distro-info,
46 libapache2-mod-wsgi,
47
48=== modified file 'debian/maas.config'
49--- debian/maas.config 2012-04-10 19:26:20 +0000
50+++ debian/maas.config 2012-04-18 06:50:39 +0000
51@@ -5,15 +5,15 @@
52
53 # creates question
54 set_question() {
55- if ! db_fget "$1" seen; then
56- db_register dbconfig-common/dbconfig-install "$1"
57- db_subst "$1" ID "$1"
58- db_fget "$1" seen
59- fi
60- if [ "$RET" = false ]; then
61- db_set "$1" "$2"
62- db_fset "$1" seen true
63- fi
64+ if ! db_fget "$1" seen; then
65+ db_register dbconfig-common/dbconfig-install "$1"
66+ db_subst "$1" ID "$1"
67+ db_fget "$1" seen
68+ fi
69+ if [ "$RET" = false ]; then
70+ db_set "$1" "$2"
71+ db_fset "$1" seen true
72+ fi
73 }
74
75 # source dbconfig-common shell library, and call the hook function
76@@ -30,4 +30,15 @@
77 set_question maas/dbconfig-install true
78 set_question maas/pgsql/app-pass ""
79 dbc_go maas $@
80+
81+elif [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
82+ db_get maas/default-maas-url || true
83+ if [ -n "$RET" ]; then
84+ db_set maas/default-maas-url "$RET"
85+ else
86+ ipaddr=$(awk '$1 == "DEFAULT_MAAS_URL" { split($0,array,"/")} END{print array[3] }' /etc/maas/maas_local_settings.py)
87+ db_set maas/default-maas-url "$ipaddr"
88+ fi
89+ db_input low maas/default-maas-url || true
90+ db_go
91 fi
92
93=== modified file 'debian/maas.postinst'
94--- debian/maas.postinst 2012-04-12 17:53:35 +0000
95+++ debian/maas.postinst 2012-04-18 06:50:39 +0000
96@@ -21,6 +21,30 @@
97 fi
98 }
99
100+restart_rabbitmq(){
101+ if [ -x /usr/sbin/invoke-rc.d ]; then
102+ invoke-rc.d rabbitmq-server restart || true
103+ else
104+ /etc/init.d/rabbitmq-server restart || true
105+ fi
106+}
107+
108+restart_postgresql(){
109+ if [ -x /usr/sbin/invoke-rc.d ]; then
110+ invoke-rc.d --force postgresql restart || true
111+ else
112+ /etc/init.d/postgresql restart || true
113+ fi
114+}
115+
116+restart_cobbler(){
117+ if [ -x /usr/sbin/invoke-rc.d ]; then
118+ invoke-rc.d cobbler restart || true
119+ else
120+ /etc/init.d/cobbler restart || true
121+ fi
122+}
123+
124 add_user_group(){
125 local user="maas"
126 local group="maas"
127@@ -46,19 +70,19 @@
128 htpasswd -D /etc/cobbler/users.digest "maas" || true
129 printf "maas:Cobbler:$hash\n" >> /etc/cobbler/users.digest
130
131- if grep -qs "^\ \{1,\}password: [a-zA-Z0-9]\{1,\}$" /etc/maas/pserv.yaml; then
132- sed -i "s/^\ \{1,\}password: [a-zA-Z0-9]\{1,\}$/ password: "$cblr_pass"/" /etc/maas/pserv.yaml
133+ if grep -qs "^\ \{1,\}password:.*$" /etc/maas/pserv.yaml; then
134+ sed -i "s/^\ \{1,\}password:.*$/ password: \""$cblr_pass"\"/" /etc/maas/pserv.yaml
135 fi
136 }
137
138 configure_maas_pserv_user() {
139 local pserv_pass=
140 pserv_pass="$(pwgen -s 20)"
141- if grep -qs "^password: \"test\"" /etc/maas/pserv.yaml; then
142- sed -i '/^password:/s/"test"/"'"${pserv_pass}"'"/' /etc/maas/pserv.yaml
143+ if grep -qs "^password: \".*\"$" /etc/maas/pserv.yaml; then
144+ sed -i '/^password:/s/".*"$/"'"${pserv_pass}"'"/' /etc/maas/pserv.yaml
145 fi
146 if grep -qs "^PSERV_URL\ =\ " /etc/maas/maas_local_settings.py; then
147- sed -i '/^PSERV_URL[ =]/s/:password@/:'"${pserv_pass}"'@/' /etc/maas/maas_local_settings.py
148+ sed -i '/^PSERV_URL[ =]/s/maas:.*@/'"maas:${pserv_pass}"'@/' /etc/maas/maas_local_settings.py
149 fi
150 }
151
152@@ -103,6 +127,23 @@
153 ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
154 }
155
156+configure_maas_default_url() {
157+ local ipaddr="$1"
158+
159+ if grep -qs "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py; then
160+ sed -i "s/^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$/DEFAULT_MAAS_URL = \"http:\/\/"$ipaddr"\/\"/" \
161+ /etc/maas/maas_local_settings.py
162+ fi
163+
164+ # Replace for PXE
165+ if grep -qs "^next_server:.*$" /etc/cobbler/settings; then
166+ sed -i "s/^next_server:.*$/next_server: $ipaddr/" /etc/cobbler/settings
167+ fi
168+ if grep -qs "^server:.*$" /etc/cobbler/settings; then
169+ sed -i "s/^server:.*$/server: $ipaddr/" /etc/cobbler/settings
170+ fi
171+}
172+
173 if [ "$1" = "configure" ] && [ -z "$2" ]; then
174 #########################################################
175 ################ User/Group Creatiion ##################
176@@ -157,11 +198,9 @@
177 ipaddr=${ipaddr%%/*}
178 # Set the IP address of the interface with default route
179 if [ -n "$ipaddr" ]; then
180- if grep -qs "^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$" /etc/maas/maas_local_settings.py; then
181- sed -i "s/^DEFAULT_MAAS_URL\ \= \"[a-zA-Z0-9:/.]\{0,\}\"$/DEFAULT_MAAS_URL = \"http:\/\/"$ipaddr"\/\"/" \
182- /etc/maas/maas_local_settings.py
183- fi
184+ configure_maas_default_url "$ipaddr"
185 db_subst maas/installation-note MAAS_URL "$ipaddr"
186+ db_set maas/default-maas-url "$ipaddr"
187 fi
188
189 #########################################################
190@@ -173,7 +212,6 @@
191 touch /var/log/maas/maas.log
192 fi
193 chown -R maas:maas /var/log/maas
194- chmod 620 /var/log/maas/maas.log
195 chmod -R 775 /var/log/maas/oops
196
197 # Create log directory base
198@@ -197,11 +235,7 @@
199 #########################################################
200
201 # Handle longpoll/rabbitmq publishing
202- if [ -x /usr/sbin/invoke-rc.d ]; then
203- invoke-rc.d rabbitmq-server restart || true
204- else
205- /etc/init.d/rabbitmq-server restart || true
206- fi
207+ restart_rabbitmq
208 configure_maas_txlongpoll_rabbitmq_user
209
210 #########################################################
211@@ -214,11 +248,7 @@
212 #########################################################
213
214 # Need to for postgresql start so it doesn't fail on the installer
215- if [ -x /usr/sbin/invoke-rc.d ]; then
216- invoke-rc.d --force postgresql restart || true
217- else
218- /etc/init.d/postgresql restart || true
219- fi
220+ restart_postgresql
221
222 # Create the database
223 dbc_go maas $@
224@@ -234,28 +264,62 @@
225 db_input high maas/installation-note || true
226 db_go
227
228+elif [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
229+ # Set the IP address of the interface with default route
230+ db_get maas/default-maas-url
231+ ipaddr="$RET"
232+ db_set maas/default-maas-url "$ipaddr"
233+ if [ -n "$ipaddr" ]; then
234+ configure_maas_default_url "$ipaddr"
235+ fi
236+ restart_cobbler
237+
238 elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then
239 # If upgrading to any later package version, then upgrade db.
240 if [ -x /usr/sbin/invoke-rc.d ]; then
241 invoke-rc.d apache2 stop || true
242 fi
243
244+ # make sure postgresql is running
245+ restart_postgresql
246+
247 # If upgrading from any version lower than 0.1+bzr445+dfsg-0ubuntu1
248 # we need to update the user/group.
249 if dpkg --compare-versions "$2" lt 0.1+bzr445+dfsg-0ubuntu1; then
250+ # add user/group
251 add_user_group
252+ # set correct permissions
253 chown -R maas:maas /var/lib/maas/
254 chown -R maas:maas /var/log/maas
255 chown -R syslog:syslog /var/log/maas/rsyslog
256+ fi
257+ if dpkg --compare-versions "$2" lt 0.1+bzr459+dfsg-0ubuntu1; then
258+ configure_maas_tgt
259+ fi
260+ # If upgrading from any version lower than 0.1+bzr462+dfsg-0ubuntu1
261+ # we need to regenerate the passwords and update configs.
262+ if dpkg --compare-versions "$2" lt 0.1+bzr473+dfsg-0ubuntu1; then
263+ # configure maas user for cobbler
264 configure_maas_cobbler_user
265+ # configure pserv user for cobbler
266 configure_maas_pserv_user
267+ # configure maas default url
268+ db_get maas/default-maas-url
269+ ipaddr="$RET"
270+ # If nothing in the database, obtain the IP from cobbler settings
271+ # which is the same as MAAS_DEFAULT_URL
272+ if [ -z "$ipaddr" ]; then
273+ ipaddr=$(awk '$1 == "server:" { print $2 }' /etc/cobbler/settings)
274+ db_set maas/default-maas-url "$ipaddr"
275+ fi
276+ configure_maas_default_url "$ipaddr"
277+ # make sure rabbitmq is running
278+ restart_rabbitmq
279 configure_maas_txlongpoll_rabbitmq_user
280+ # handle database upgrade
281 dbc_go maas $@
282 configure_maas_database "$dbc_dbpass"
283 fi
284- if dpkg --compare-versions "$2" lt 0.1+bzr459+dfsg-0ubuntu1; then
285- configure_maas_tgt
286- fi
287
288 maas_sync_migrate_db
289 restart_apache2
290
291=== modified file 'debian/maas.templates'
292--- debian/maas.templates 2012-04-04 18:52:33 +0000
293+++ debian/maas.templates 2012-04-18 06:50:39 +0000
294@@ -6,3 +6,17 @@
295 can access the MAAS Web interface here:
296 .
297 http://${MAAS_URL}/MAAS
298+ .
299+ If the automatically detected address above is not in the same
300+ network as the MAAS clients, you need to reconfigure it:
301+ .
302+ sudo dpkg-reconfigure maas
303+
304+Template: maas/default-maas-url
305+Type: string
306+_Description: Ubuntu MAAS PXE/Provisioning network address:
307+ The Ubuntu MAAS Server automatically detects the IP address
308+ that is used for PXE and provisioning. However, it needs to be
309+ in the same network as the clients. If the automatically
310+ detected address is not in the same network as the clients, it
311+ must be changed.

Subscribers

People subscribed via source and target branches

to all changes: