Merge lp:~bladernr/maas-cert-server/mcs-install-curtin_userdata-by-packaging into lp:~hardware-certification/maas-cert-server/trunk

Proposed by Jeff Lane 
Status: Merged
Approved by: Jeff Lane 
Approved revision: 60
Merged at revision: 59
Proposed branch: lp:~bladernr/maas-cert-server/mcs-install-curtin_userdata-by-packaging
Merge into: lp:~hardware-certification/maas-cert-server/trunk
Diff against target: 92 lines (+57/-12)
3 files modified
debian/changelog (+8/-0)
debian/postinst (+49/-0)
usr/sbin/maniacs-setup (+0/-12)
To merge this branch: bzr merge lp:~bladernr/maas-cert-server/mcs-install-curtin_userdata-by-packaging
Reviewer Review Type Date Requested Status
Rod Smith Approve
Review via email: mp+299374@code.launchpad.net

Description of the change

Moves the copying of curtin_userdata and preseeds out of maniacs-setup and into packaging via postinst script.

This ensures that upgrading the package will also upgrade these files preventing a nasty situation where users may upgrade MCS repeatedly, but never re-run maniacs-setup and thus end up with stale, broken curtin_userdata files.

It does prompt the user after installation to run maniacs-setup to update.

If users have configured a local mirror, of course, this will break mirror usage until they re-run maniacs-setup --update-preseeds, but that breakage will be a lot more obvious than the breakage that occurs when the preseeds are downrev compared to the rest of the mcs files.

To post a comment you must log in.
60. By Jeff Lane 

A little more detail in the ending message and some cleanup in maniacs-setup

Revision history for this message
Rod Smith (rodsmith) wrote :

I've done a simple test upgrade using this version and it seemed to go OK. Based on that and your comment in the bug report that you've tested it more extensively yourself, I'll approve this. That said, I think that this change interacts with others we've been considering, so we may end up making further changes in the not-too-distant future. I'll comment more in the bug report....

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 2016-06-29 15:17:40 +0000
3+++ debian/changelog 2016-07-07 04:02:40 +0000
4@@ -1,3 +1,11 @@
5+maas-cert-server (0.2.22-0ppa1) trusty; urgency=medium
6+
7+ * Add new postinst script to handle the installation of
8+ curtin_userdata and preseed files.
9+ * Removed corresponding code from maniacs-setup
10+
11+ -- Jeff Lane <jeff@ubuntu.com> Wed, 06 Jul 2016 23:48:36 -0400
12+
13 maas-cert-server (0.2.20-0ppa1) trusty; urgency=medium
14
15 * Modify the preseeds to have them update dmidecode
16
17=== added file 'debian/postinst'
18--- debian/postinst 1970-01-01 00:00:00 +0000
19+++ debian/postinst 2016-07-07 04:02:40 +0000
20@@ -0,0 +1,49 @@
21+#! /bin/sh -e
22+
23+# Postinstall scritpt for maas-cert-server
24+
25+timestamp=`date +%Y%m%d_%H%M%S`
26+
27+# lets install custom curtin_userdata and preseeds during package installation
28+# so that updated packages always provide the latest versions automatically.
29+if [ ! -f /etc/maas/preseeds/generic-orig ] && [ -f /etc/maas/preseeds/generic ] ; then
30+ cp /etc/maas/preseeds/generic /etc/maas/preseeds/generic-orig
31+fi
32+if [ -f /etc/maas/preseeds/generic-orig ] && [ -f /etc/maas/preseeds/generic ] ; then
33+ cp /etc/maas/preseeds/generic /etc/maas/preseeds/generic-$timestamp
34+fi
35+cp /usr/share/maas-cert-server/preseed/stable-preseed-generic /etc/maas/preseeds/generic
36+
37+if [ ! -f /etc/maas/preseeds/curtin_userdata-orig ] ; then
38+ cp /etc/maas/preseeds/curtin_userdata /etc/maas/preseeds/curtin_userdata-orig
39+fi
40+if [ -f /etc/maas/preseeds/curtin_userdata-orig ] ; then
41+ cp /etc/maas/preseeds/curtin_userdata /etc/maas/preseeds/curtin_userdata-$timestamp
42+fi
43+cp /usr/share/maas-cert-server/preseed/curtin_userdata_cert /etc/maas/preseeds/curtin_userdata
44+
45+if [ ! -f /etc/maas/preseeds/curtin_userdata_custom-orig ] ; then
46+ cp /etc/maas/preseeds/curtin_userdata_custom /etc/maas/preseeds/curtin_userdata_custom-orig
47+fi
48+if [ -f /etc/maas/preseeds/curtin_userdata_custom-orig ] ; then
49+ cp /etc/maas/preseeds/curtin_userdata_custom /etc/maas/preseeds/curtin_userdata_custom-$timestamp
50+fi
51+cp /usr/share/maas-cert-server/preseed/curtin_userdata_custom_cert /etc/maas/preseeds/curtin_userdata_custom
52+
53+
54+echo "***********************************************************************"
55+echo
56+echo " Installation complete. Now run /usr/sbin/maniacs-setup if necessary"
57+echo " to complete or update the configuration of your new Certification"
58+echo " MAAS Server."
59+echo " NOTE: If you have previously configured a local apt mirror, you will"
60+echo " need to run 'sudo maniacs-setup --update-preseeds' to ensure your"
61+echo " nodes will be deployed with the correct archive data."
62+echo
63+echo " Usage: /usr/sbin/maniacs-setup [ --download-virtualization-image ]"
64+echo " [ --import-boot-resources ] [ --mirror-archives ]"
65+echo " [ --update-point-releases ] [ --update-preseeds ]"
66+echo
67+echo "***********************************************************************"
68+
69+
70
71=== modified file 'usr/sbin/maniacs-setup'
72--- usr/sbin/maniacs-setup 2016-05-05 20:19:02 +0000
73+++ usr/sbin/maniacs-setup 2016-07-07 04:02:40 +0000
74@@ -751,18 +751,6 @@
75 echo "***************************************************************************"
76 echo "* Setting up certification preseed files...."
77 echo "*"
78- if [ ! -f /etc/maas/preseeds/generic-orig ] && [ -f /etc/maas/preseeds/generic ] ; then
79- cp /etc/maas/preseeds/generic /etc/maas/preseeds/generic-orig
80- fi
81- cp /usr/share/maas-cert-server/preseed/stable-preseed-generic /etc/maas/preseeds/generic
82- if [ ! -f /etc/maas/preseeds/curtin_userdata-orig ] ; then
83- cp /etc/maas/preseeds/curtin_userdata /etc/maas/preseeds/curtin_userdata-orig
84- fi
85- cp /usr/share/maas-cert-server/preseed/curtin_userdata_cert /etc/maas/preseeds/curtin_userdata
86- if [ ! -f /etc/maas/preseeds/curtin_userdata_custom-orig ] ; then
87- cp /etc/maas/preseeds/curtin_userdata_custom /etc/maas/preseeds/curtin_userdata_custom-orig
88- fi
89- cp /usr/share/maas-cert-server/preseed/curtin_userdata_custom_cert /etc/maas/preseeds/curtin_userdata_custom
90 if [ $MIRRORED -eq 1 ] ; then
91 sed -i s/ppa.launchpad.net/$INTERNAL_IP/g /etc/maas/preseeds/generic
92 sed -i s/ppa.launchpad.net/$INTERNAL_IP/g /etc/maas/preseeds/curtin_userdata

Subscribers

People subscribed via source and target branches

to status/vote changes: