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
=== modified file 'debian/changelog'
--- debian/changelog 2016-06-29 15:17:40 +0000
+++ debian/changelog 2016-07-07 04:02:40 +0000
@@ -1,3 +1,11 @@
1maas-cert-server (0.2.22-0ppa1) trusty; urgency=medium
2
3 * Add new postinst script to handle the installation of
4 curtin_userdata and preseed files.
5 * Removed corresponding code from maniacs-setup
6
7 -- Jeff Lane <jeff@ubuntu.com> Wed, 06 Jul 2016 23:48:36 -0400
8
1maas-cert-server (0.2.20-0ppa1) trusty; urgency=medium9maas-cert-server (0.2.20-0ppa1) trusty; urgency=medium
210
3 * Modify the preseeds to have them update dmidecode11 * Modify the preseeds to have them update dmidecode
412
=== added file 'debian/postinst'
--- debian/postinst 1970-01-01 00:00:00 +0000
+++ debian/postinst 2016-07-07 04:02:40 +0000
@@ -0,0 +1,49 @@
1#! /bin/sh -e
2
3# Postinstall scritpt for maas-cert-server
4
5timestamp=`date +%Y%m%d_%H%M%S`
6
7# lets install custom curtin_userdata and preseeds during package installation
8# so that updated packages always provide the latest versions automatically.
9if [ ! -f /etc/maas/preseeds/generic-orig ] && [ -f /etc/maas/preseeds/generic ] ; then
10 cp /etc/maas/preseeds/generic /etc/maas/preseeds/generic-orig
11fi
12if [ -f /etc/maas/preseeds/generic-orig ] && [ -f /etc/maas/preseeds/generic ] ; then
13 cp /etc/maas/preseeds/generic /etc/maas/preseeds/generic-$timestamp
14fi
15cp /usr/share/maas-cert-server/preseed/stable-preseed-generic /etc/maas/preseeds/generic
16
17if [ ! -f /etc/maas/preseeds/curtin_userdata-orig ] ; then
18 cp /etc/maas/preseeds/curtin_userdata /etc/maas/preseeds/curtin_userdata-orig
19fi
20if [ -f /etc/maas/preseeds/curtin_userdata-orig ] ; then
21 cp /etc/maas/preseeds/curtin_userdata /etc/maas/preseeds/curtin_userdata-$timestamp
22fi
23cp /usr/share/maas-cert-server/preseed/curtin_userdata_cert /etc/maas/preseeds/curtin_userdata
24
25if [ ! -f /etc/maas/preseeds/curtin_userdata_custom-orig ] ; then
26 cp /etc/maas/preseeds/curtin_userdata_custom /etc/maas/preseeds/curtin_userdata_custom-orig
27fi
28if [ -f /etc/maas/preseeds/curtin_userdata_custom-orig ] ; then
29 cp /etc/maas/preseeds/curtin_userdata_custom /etc/maas/preseeds/curtin_userdata_custom-$timestamp
30fi
31cp /usr/share/maas-cert-server/preseed/curtin_userdata_custom_cert /etc/maas/preseeds/curtin_userdata_custom
32
33
34echo "***********************************************************************"
35echo
36echo " Installation complete. Now run /usr/sbin/maniacs-setup if necessary"
37echo " to complete or update the configuration of your new Certification"
38echo " MAAS Server."
39echo " NOTE: If you have previously configured a local apt mirror, you will"
40echo " need to run 'sudo maniacs-setup --update-preseeds' to ensure your"
41echo " nodes will be deployed with the correct archive data."
42echo
43echo " Usage: /usr/sbin/maniacs-setup [ --download-virtualization-image ]"
44echo " [ --import-boot-resources ] [ --mirror-archives ]"
45echo " [ --update-point-releases ] [ --update-preseeds ]"
46echo
47echo "***********************************************************************"
48
49
050
=== modified file 'usr/sbin/maniacs-setup'
--- usr/sbin/maniacs-setup 2016-05-05 20:19:02 +0000
+++ usr/sbin/maniacs-setup 2016-07-07 04:02:40 +0000
@@ -751,18 +751,6 @@
751 echo "***************************************************************************"751 echo "***************************************************************************"
752 echo "* Setting up certification preseed files...."752 echo "* Setting up certification preseed files...."
753 echo "*"753 echo "*"
754 if [ ! -f /etc/maas/preseeds/generic-orig ] && [ -f /etc/maas/preseeds/generic ] ; then
755 cp /etc/maas/preseeds/generic /etc/maas/preseeds/generic-orig
756 fi
757 cp /usr/share/maas-cert-server/preseed/stable-preseed-generic /etc/maas/preseeds/generic
758 if [ ! -f /etc/maas/preseeds/curtin_userdata-orig ] ; then
759 cp /etc/maas/preseeds/curtin_userdata /etc/maas/preseeds/curtin_userdata-orig
760 fi
761 cp /usr/share/maas-cert-server/preseed/curtin_userdata_cert /etc/maas/preseeds/curtin_userdata
762 if [ ! -f /etc/maas/preseeds/curtin_userdata_custom-orig ] ; then
763 cp /etc/maas/preseeds/curtin_userdata_custom /etc/maas/preseeds/curtin_userdata_custom-orig
764 fi
765 cp /usr/share/maas-cert-server/preseed/curtin_userdata_custom_cert /etc/maas/preseeds/curtin_userdata_custom
766 if [ $MIRRORED -eq 1 ] ; then754 if [ $MIRRORED -eq 1 ] ; then
767 sed -i s/ppa.launchpad.net/$INTERNAL_IP/g /etc/maas/preseeds/generic755 sed -i s/ppa.launchpad.net/$INTERNAL_IP/g /etc/maas/preseeds/generic
768 sed -i s/ppa.launchpad.net/$INTERNAL_IP/g /etc/maas/preseeds/curtin_userdata756 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: