Package: fai-client
Version: 4.0.8~deb7u1
Severity: wishlist
Tags: patch

Dear Maintainer,

when using a savelog hook to replace the savelog functionality with a
custom variant (and using skip to make sure the original hook is not
run), this currently only works if the installation is successful, but
not if an error occurred. Unfortunately, the error case is the one that
is far more important for an administrator.

I've attached a patch against current git master that makes sure the
hooks for savelog are also called on failure. The patch should also
apply against older versions. The patch also makes sure that if another
earlier hook made the call to skip savelog, this will also be honored.

Thanks!
From 8542d992bef188c3c58b649455bf24ee288b305e Mon Sep 17 00:00:00 2001
From: Christian Seiler <christ...@iwakd.de>
Date: Mon, 6 Oct 2014 17:43:56 +0200
Subject: [PATCH] On failure: also call hooks for savelog

If one uses savelog hooks to replace the existing functionality with
something different, or to do some additional action at that point that
may be required for savelog to work, make sure the hooks are also
called on failure, not only if the installation is successful.
---
 lib/subroutines |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/subroutines b/lib/subroutines
index 16d5de5..8981fbc 100755
--- a/lib/subroutines
+++ b/lib/subroutines
@@ -34,7 +34,8 @@
 die() {
 
     # echo comment and exit installation
-    task_savelog
+    [ -f $LOGDIR/skip.$taskname ] || call_hook savelog
+    [ -f $LOGDIR/skip.$taskname ] || task_savelog
     echo "$@"
     if [ X$FAI_ACTION = Xinstall ]; then
         exec bash -i
-- 
1.7.10.4

Reply via email to