launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #14771
[Merge] lp:~jtv/maas/pkg-bug-1086239 into lp:~maas-maintainers/maas/packaging
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/pkg-bug-1086239 into lp:~maas-maintainers/maas/packaging.
Commit message:
Duplicate CLUSTER_UUID setting from celery config into maas_cluster.conf.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1086239 in MAAS: "CLUSTER_UUID is in cluster celery config, but tftpd needs it"
https://bugs.launchpad.net/maas/+bug/1086239
For more details, see:
https://code.launchpad.net/~jtv/maas/pkg-bug-1086239/+merge/139146
As per discussion with Julian. The tftpd needs to know the UUID for the cluster it serves, in order to pass it to the pxeconfig API call. Currently that UUID is only configured in the celery config, and we don't want to import that into the pserv process (which is what serves our tftp). We intend to clean up the duplication later, leaving only the new location for the UUID setting, where both our celery processes and our pserv processes can read it.
Once this branch is landed, we can have pserv read the UUID from maas_cluster.conf instead of from maas_local_celeryconfig_cluster.py.
The main cost factor for this branch was our inability to unit-test the packaging scripts. I verified manually that the new code does the right thing both during upgrade and in a fresh install.
Jeroen
--
https://code.launchpad.net/~jtv/maas/pkg-bug-1086239/+merge/139146
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/pkg-bug-1086239 into lp:~maas-maintainers/maas/packaging.
=== modified file 'debian/changelog'
--- debian/changelog 2012-12-03 13:13:07 +0000
+++ debian/changelog 2012-12-11 07:33:22 +0000
@@ -1,4 +1,4 @@
-maas (0.1+bzr1366+dfsg-0ubuntu2) UNRELEASED; urgency=low
+maas (0.1+bzr1393+dfsg-0ubuntu2) UNRELEASED; urgency=low
[ Raphaël Badin ]
* debian/maas-dns.postinst: Call write_dns_config.
=== modified file 'debian/maas-cluster-controller.postinst'
--- debian/maas-cluster-controller.postinst 2012-11-27 14:08:08 +0000
+++ debian/maas-cluster-controller.postinst 2012-12-11 07:33:22 +0000
@@ -26,6 +26,48 @@
ln -sf /var/lib/maas/ephemeral/tgt.conf /etc/tgt/conf.d/maas.conf
}
+extract_cluster_uuid(){
+ # Extract ClUSTER_UUID setting from config file $1. This will work
+ # both the cluster celery config (which is python) and the cluster
+ # config (which is shell).
+ local config_file="$1"
+ grep "^CLUSTER_UUID *= *[\"'][^\"']*[\"']" $config_file |
+ sed -e "s/^CLUSTER_UUID *= *\"\([^\"']*\)\".*/\1/"
+}
+
+configure_cluster_uuid(){
+ # The cluster uuid goes into maas_cluster.conf, but we also still
+ # keep a copy in maas_local_celeryconfig_cluster.py (hopefully just
+ # temporarily). If an old uuid is configured, we replicate that to
+ # maas_cluster.conf; otherwise, we want to generate one.
+ local uuid
+
+
+ if [ -n "$(extract_cluster_uuid /etc/maas/maas_cluster.conf)" ]; then
+ # UUID is already set up. Wonderful.
+ return
+ fi
+
+ # Look for a UUID stored in the old location.
+ uuid="$(extract_cluster_uuid /etc/maas/maas_local_celeryconfig_cluster.py)"
+
+ if [ -z "$uuid" ]; then
+ # No UUID at all yet. Generate one, and insert it into its
+ # placeholder in the old config location.
+ uuid="$(uuidgen)"
+ sed -i "s|^CLUSTER_UUID = None$|CLUSTER_UUID = '$uuid'|" \
+ /etc/maas/maas_local_celeryconfig_cluster.py
+ fi
+
+ # Either way, at this point we have a uuid, and it is configured in
+ # the old config location.
+ #
+ # Write it to maas_cluster.conf as well. There is no initial
+ # placeholder in this file, so just append the setting.
+ echo "CLUSTER_UUID=\"$uuid\"" >>/etc/maas/maas_cluster.conf
+}
+
+
if [ "$1" = "configure" ] && [ -z "$2" ]; then
# logging
create_log_dir
@@ -35,13 +77,6 @@
chown root:maas /etc/maas/maas_local_celeryconfig_cluster.py
chmod 0640 /etc/maas/maas_local_celeryconfig_cluster.py
- # Generate cluster UUID.
- if grep -qs "^CLUSTER_UUID\ \= None$" /etc/maas/maas_local_celeryconfig_cluster.py; then
- uuid="$(uuidgen)"
- sed -i "s|^CLUSTER_UUID\ \= None$|CLUSTER_UUID = '"$uuid"'|" \
- /etc/maas/maas_local_celeryconfig_cluster.py
- fi
-
configure_maas_tgt
fi
@@ -63,5 +98,9 @@
fi
fi
+if [ "$1" = "configure" ]; then
+ configure_cluster_uuid
+fi
+
#DEBHELPER#
exit 0
Follow ups