[Pkg-ganeti-devel] [ganeti] 02/02: postinst: refactor workarounds for all bugs

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Thu Mar 20 09:15:37 UTC 2014


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository ganeti.

commit 6bda14e8850f5c69b665ff89ed105782efcc6587
Author: Apollon Oikonomopoulos <apoikos at debian.org>
Date:   Thu Mar 20 11:12:50 2014 +0200

    postinst: refactor workarounds for all bugs
    
    Working around pre-2.9 bugs relied on prerm having stopped all daemons,
    which is not the case anymore. Any future upgrades would accidentally
    delete the haskell daemon PID files and sockets while the daemons were
    still running. Subsequently all haskell daemons would be started twice.
    
    We add a check against upgrading from versions before 2.9.0 for that.
---
 debian/ganeti.postinst.in | 48 +++++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/debian/ganeti.postinst.in b/debian/ganeti.postinst.in
index aafbfb5..f33e381 100644
--- a/debian/ganeti.postinst.in
+++ b/debian/ganeti.postinst.in
@@ -20,28 +20,6 @@ case "$1" in
     configure)
 #GANETI_USERS#
 
-	# Remove stale PID files
-	# Ganeti versions prior to 2.8.0~rc4 leave Haskell daemon pidfiles
-	# behind. If these are root-owned, starting the daemons as unprivileged
-	# users will fail.
-
-	# All daemons have been stopped during prerm, so it's safe to remove
-	# their PID files.
-	for daemon in confd mond luxid; do
-		rm -f /var/run/ganeti/ganeti-${daemon}.pid
-	done
-
-	# Also remove luxid's socket
-	rm -f /var/run/ganeti/socket/ganeti-query
-
-	# Since 2.9.0, mond runs as root, so remove the old gnt-mond user (that
-	# was also created during 2.9.0~rcX.
-	if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.9.0 && \
-			getent passwd gnt-mond >/dev/null; then
-		find /var/log/ganeti -user gnt-mond -exec chown root:root {} \;
-		deluser --system gnt-mond || true
-	fi
-
 	update_symlinks=0
 	# Handle symlinks...
 	# ... if we are upgrading from pre-2.10 versions
@@ -74,6 +52,32 @@ case "$1" in
 			invoke-rc.d ganeti stop || true
 		fi
 	fi
+
+	# Work around bugs of older (pre 2.9) versions. In this case all
+	# daemons have already been stopped by the old package's prerm.
+	if [ -n "$2" ] && dpkg --compare-versions "$2" lt 2.9.0; then
+		# Since 2.9.0, mond runs as root, so remove the old gnt-mond user (that
+		# was also created during 2.9.0~rcX.
+		if getent passwd gnt-mond >/dev/null; then
+			find /var/log/ganeti -user gnt-mond -exec chown root:root {} \;
+			deluser --system gnt-mond || true
+		fi
+
+		# Remove stale PID files
+		# Ganeti versions prior to 2.8.0~rc4 leave Haskell daemon pidfiles
+		# behind. If these are root-owned, starting the daemons as unprivileged
+		# users will fail.
+
+		# All daemons have been stopped, so it's safe to remove
+		# their PID files.
+		for daemon in confd mond luxid; do
+			rm -f /var/run/ganeti/ganeti-${daemon}.pid
+		done
+
+		# Also remove luxid's socket
+		rm -f /var/run/ganeti/socket/ganeti-query
+	fi
+
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git



More information about the Pkg-ganeti-devel mailing list