Merge lp:~allenap/maas/packaging.kill-all-the-configs-cluster into lp:~maas-maintainers/maas/packaging

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 414
Merged at revision: 409
Proposed branch: lp:~allenap/maas/packaging.kill-all-the-configs-cluster
Merge into: lp:~maas-maintainers/maas/packaging
Diff against target: 282 lines (+41/-102)
8 files modified
debian/changelog (+3/-0)
debian/maas-cluster-controller.install (+0/-6)
debian/maas-cluster-controller.maas-clusterd.service (+1/-5)
debian/maas-cluster-controller.maas-clusterd.upstart (+1/-16)
debian/maas-cluster-controller.postinst (+24/-51)
debian/maas-region-controller-min.apport (+12/-5)
debian/patches/02-pserv-config.patch (+0/-18)
debian/patches/series (+0/-1)
To merge this branch: bzr merge lp:~allenap/maas/packaging.kill-all-the-configs-cluster
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+263521@code.launchpad.net

Commit message

Use new local configuration support for the cluster.

Description of the change

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Gavin,

I tested this and overall it looks good:

1. Fresh install worked just fine.
2. Upgrade seemed to go ok, but it seems that it didn't migrate the config as expected. However, I think we can still merge this and look for other corner cases as I have not tested every single possible scenario and I'm thinking of making some packaging changes.

That being said, I think we can land and keep improving.

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

Also, don't forget to add changelog entries please and I have one comment inline.

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

Gavin,

I made some improvements to your branch. You can just land this one and I'll follow up with:

https://code.launchpad.net/~andreserl/maas/improve_packaging_regiond_clusterd/+merge/263607

review: Approve
Revision history for this message
Gavin Panella (allenap) wrote :

> Gavin,
>
> I made some improvements to your branch. You can just land this one and
> I'll follow up with:
>
> https://code.launchpad.net/~andreserl/maas/improve_packaging_regiond_clusterd/+merge/263607

Thanks!

Do I need to do anything in this branch? It looks like I need to update
the changelog. There's also your inline comment about upgrades from <=
1.8: does your branch take care of that or should I fix it?

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

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

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 2015-06-26 11:49:32 +0000
3+++ debian/changelog 2015-07-02 16:28:13 +0000
4@@ -5,6 +5,9 @@
5 [ Raphaƫl Badin ]
6 * Enable proxy_wstunnel module.
7
8+ [ Gavin Panella ]
9+ * Use new local configuration support for the cluster.
10+
11 -- Andres Rodriguez <andreserl@ubuntu.com> Fri, 12 Jun 2015 14:16:47 -0400
12
13 maas (1.8.0+bzr4001-0ubuntu1) trusty; urgency=medium
14
15=== modified file 'debian/maas-cluster-controller.install'
16--- debian/maas-cluster-controller.install 2015-03-25 16:35:38 +0000
17+++ debian/maas-cluster-controller.install 2015-07-02 16:28:13 +0000
18@@ -1,12 +1,6 @@
19 # Install twisted plugins
20 twisted/plugins/maasclusterd.py usr/share/pyshared/twisted/plugins
21
22-# Install PSERV config file
23-debian/tmp/etc/maas/pserv.yaml
24-
25-# Install cluster config file
26-debian/tmp/etc/maas/maas_cluster.conf
27-
28 # Install templates
29 debian/tmp/etc/maas/templates/dhcp
30 debian/tmp/etc/maas/templates/power
31
32=== modified file 'debian/maas-cluster-controller.maas-clusterd.service'
33--- debian/maas-cluster-controller.maas-clusterd.service 2015-05-21 16:54:25 +0000
34+++ debian/maas-cluster-controller.maas-clusterd.service 2015-07-02 16:28:13 +0000
35@@ -4,15 +4,11 @@
36 Requires=network-online.target
37 After=network-online.target
38 ConditionPathExists=/var/lib/maas/secret
39-# These will go away one we support new config files.
40-ConditionPathExists=/etc/maas/maas_cluster.conf
41-ConditionPathExists=/etc/maas/pserv.yaml
42
43 [Service]
44 User=maas
45 Group=maas
46 Restart=always
47-EnvironmentFile=/etc/maas/maas_cluster.conf
48 Environment="LOGFILE=/var/log/maas/clusterd.log"
49 # Logs go to the journal; read them with
50 # journalctl -u maas-clusterd
51@@ -20,7 +16,7 @@
52 # should now be preferred as the $LOGFILE will be removed in MAAS 1.9.
53 ExecStart=/bin/sh -c \
54 'exec /usr/bin/authbind --deep /usr/bin/twistd --nodaemon --pidfile= \
55- maas-clusterd --config-file=/etc/maas/pserv.yaml 2>&1 | tee -a $LOGFILE'
56+ maas-clusterd 2>&1 | tee -a $LOGFILE'
57
58 [Install]
59 WantedBy=multi-user.target
60
61=== modified file 'debian/maas-cluster-controller.maas-clusterd.upstart'
62--- debian/maas-cluster-controller.maas-clusterd.upstart 2015-01-23 14:56:56 +0000
63+++ debian/maas-cluster-controller.maas-clusterd.upstart 2015-07-02 16:28:13 +0000
64@@ -6,28 +6,13 @@
65
66 respawn
67
68-env CONFIG_FILE=/etc/maas/maas_cluster.conf
69 env LOGFILE=/var/log/maas/clusterd.log
70
71-pre-start script
72- if [ ! -f $CONFIG_FILE ]; then
73- echo "$CONFIG_FILE does not exist. Aborting."
74- stop
75- exit 0
76- fi
77-end script
78-
79 script
80 # Exit immediately on error, and treat unset variables as errors. In
81 # sh/dash, unfortunately, the following does not cause the use of an unset
82 # variable to halt the script, it merely prints an error and sets $?.
83 set -o errexit -o nounset
84- # Load the configuration file.
85- . $CONFIG_FILE
86- # The MAAS cluster controller needs both CLUSTER_UUID and MAAS_URL to
87- # operate.
88- export CLUSTER_UUID
89- export MAAS_URL
90 # Check for the shared-secret. If it's not here, sleep for a while, then
91 # exit and allow respawn to do its thing.
92 if ! maas-provision check-for-shared-secret >/dev/null; then
93@@ -48,5 +33,5 @@
94 # To add options to your daemon, edit the line below:
95 exec /usr/bin/authbind --deep \
96 /usr/bin/twistd --nodaemon --uid=maas --gid=maas --pidfile= \
97- maas-clusterd --config-file=/etc/maas/pserv.yaml > ${LOGFILE} 2>&1
98+ maas-clusterd > ${LOGFILE} 2>&1
99 end script
100
101=== modified file 'debian/maas-cluster-controller.postinst'
102--- debian/maas-cluster-controller.postinst 2015-05-21 16:55:24 +0000
103+++ debian/maas-cluster-controller.postinst 2015-07-02 16:28:13 +0000
104@@ -32,35 +32,14 @@
105 }
106
107 extract_cluster_uuid(){
108- # Extract ClUSTER_UUID setting from config file $1. This will work
109- # the cluster config (which is shell).
110- sed -n -e "s/^CLUSTER_UUID *= *[\"']\([^\"']*\).*/\1/p" "$1"
111+ # Extract ClUSTER_UUID setting from config file $1. This will work
112+ # on the old the cluster config file (which is shell).
113+ awk '{ split($1,array,"\"")} END{print array[2] }' "$1"
114 }
115
116 configure_cluster_uuid(){
117- # The cluster uuid goes into maas_cluster.conf. If an old uuid is
118- # configured, we replicate that to maas_cluster.conf; otherwise,
119- # we want to generate one.
120- local uuid
121-
122- if [ -n "$(extract_cluster_uuid /etc/maas/maas_cluster.conf)" ]; then
123- # UUID is already set up. Wonderful.
124- return
125- else
126- # No UUID at all yet. Generate one.
127- uuid="$(uuidgen)"
128- fi
129-
130- # Write the uuid to maas_cluster.conf
131- # There is no initial placeholder in this file, so just append the setting.
132- echo "CLUSTER_UUID=\"$uuid\"" >>/etc/maas/maas_cluster.conf
133-}
134-
135-enable_apache_version_mod(){
136- COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
137- if [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
138- a2enmod version
139- fi
140+ # This will configure a UUID if one has not previously been set.
141+ maas-provision config --init
142 }
143
144 configure_cluster_authbind() {
145@@ -78,19 +57,11 @@
146 chmod 700 /etc/authbind/byuid/$MAAS_UID
147 }
148
149-restart_apache2(){
150- if [ -x /usr/sbin/invoke-rc.d ]; then
151- invoke-rc.d apache2 restart || true
152- else
153- /etc/init.d/apache2 restart || true
154- fi
155-}
156-
157 configure_maas_url(){
158- # Get the MAAS_URL on configure/reconfigure and write it to the conf files.
159+ # Get the MAAS URL on configure/reconfigure and write it to the conf files.
160 db_get maas-cluster-controller/maas-url || true
161 if [ -n "$RET" ]; then
162- maas-provision configure-maas-url "$RET"
163+ maas-provision config --region-url "$RET"
164 fi
165 }
166
167@@ -103,35 +74,37 @@
168 fi
169 }
170
171-
172 if [ "$1" = "configure" ] && [ -z "$2" ]; then
173 create_log_dir
174 create_var_dir
175 configure_maas_tgt
176-fi
177-
178-if [ "$1" = "configure" ]; then
179- create_log_dir
180-
181- configure_maas_tgt
182+ configure_maas_url
183+ configure_cluster_uuid
184+ configure_cluster_authbind
185+ maas-provision upgrade-cluster
186+
187+elif [ -n "$DEBCONF_RECONFIGURE" ]; then
188 configure_maas_url
189 # Only ask for a shared secret when the region is not installed
190 # on the same system.
191- if [ -n "$DEBCONF_RECONFIGURE" ] && [ ! -f /usr/sbin/maas-region-admin ]; then
192+ if [ ! -f /usr/sbin/maas-region-admin ]; then
193 db_input high maas-cluster-controller/shared-secret
194 db_go
195 fi
196 configure_shared_secret
197
198- # This config file may contain a private cluster UUID. Only maas
199- # can read it; only root can write it.
200- chown root:maas /etc/maas/maas_cluster.conf
201- chmod 0640 /etc/maas/maas_cluster.conf
202+elif [ "$1" = "configure" ] && dpkg --compare-versions "$2" gt 0.1+bzr266+dfsg-0ubuntu1; then
203+ # If we are upgrading from an older version, then we need to obtain
204+ # the cluster UUID from the old configuration file and set it with
205+ # the new configuration tool.
206+ if [ -f /etc/maas/maas_cluster.conf ]; then
207+ uuid=$(extract_cluster_uuid /etc/maas/maas_cluster.conf)
208+ maas-provision config --uuid "$uuid"
209+ mv /etc/maas/maas_cluster.conf /etc/maas/maas_cluster.conf.maas-old
210+ mv /etc/maas/pserv.yaml /etc/maas/pserv.yaml.maas-old
211+ fi
212
213- configure_cluster_uuid
214 configure_cluster_authbind
215- enable_apache_version_mod
216- restart_apache2
217 maas-provision upgrade-cluster
218 fi
219
220
221=== modified file 'debian/maas-region-controller-min.apport'
222--- debian/maas-region-controller-min.apport 2015-06-24 21:23:05 +0000
223+++ debian/maas-region-controller-min.apport 2015-07-02 16:28:13 +0000
224@@ -36,17 +36,24 @@
225
226 def add_info(report, ui):
227 response = ui.yesno(
228- "The contents of your /etc/maas/regiond.conf, "
229- "/etc/maas/pserv.yaml files may help developers diagnose your bug "
230- "more quickly. However, it may contain sensitive information. Do "
231- "you want to include it in your bug report?")
232+ "The contents of /etc/maas/regiond.conf and /etc/maas/clusterd.conf "
233+ "may help developers diagnose your bug more quickly. However, it may "
234+ "contain sensitive information. Do you want to include it in your bug "
235+ "report?")
236
237- if response is None: # user cancelled
238+ if response is None:
239+ # The user cancelled.
240 raise StopIteration
241 elif response is True:
242+ # The user agreed to include the configuration files.
243 attach_conffiles(report, 'maas')
244 attach_file_if_exists(
245 report, '/etc/maas/regiond.conf', 'MAASRegionConfig')
246+ attach_file_if_exists(
247+ report, '/etc/maas/clusterd.conf', 'MAASClusterConfig')
248+ else:
249+ # The user declined to include the configuration files.
250+ pass
251
252 # Attaching log files (Upstart).
253 attach_file_if_exists(
254
255=== removed file 'debian/patches/02-pserv-config.patch'
256--- debian/patches/02-pserv-config.patch 2015-06-24 21:25:03 +0000
257+++ debian/patches/02-pserv-config.patch 1970-01-01 00:00:00 +0000
258@@ -1,18 +0,0 @@
259-Description: Use default settings for MAAS PSERV
260- Use default settings for MAAS pserv. These default settings
261- include port, logfile, oops directory, cobbler url and username
262-Author: Andres Rodriguez <andreserl@ubuntu.com>
263-
264-=== modified file 'etc/maas/pserv.yaml'
265-Index: maas-1.8.0~beta5+bzr3849.orig/etc/maas/pserv.yaml
266-===================================================================
267---- maas-1.8.0~beta5+bzr3849.orig.orig/etc/maas/pserv.yaml 2015-04-29 02:40:55.703960406 -0400
268-+++ maas-1.8.0~beta5+bzr3849.orig/etc/maas/pserv.yaml 2015-04-29 02:41:10.567959953 -0400
269-@@ -18,7 +18,6 @@
270- # resource_root: /var/lib/maas/boot-resources/current/
271-
272- # port: 69
273-- port: 5244
274- ## The URL to be contacted to generate PXE configurations.
275- # generator: http://localhost/MAAS/api/1.0/pxeconfig/
276- generator: http://localhost:5240/MAAS/api/1.0/pxeconfig/
277
278=== modified file 'debian/patches/series'
279--- debian/patches/series 2015-03-31 03:23:42 +0000
280+++ debian/patches/series 2015-07-02 16:28:13 +0000
281@@ -1,1 +0,0 @@
282-02-pserv-config.patch

Subscribers

People subscribed via source and target branches