From 11cea6807a235eb14fe03d5abbc455d32cffde56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Str=C3=B6mb=C3=A4ck?= <filip.stromback@liu.se>
Date: Thu, 20 Jun 2024 13:26:20 +0200
Subject: [PATCH] Another attempt at logging update failures.

---
 files/tal/on_update.sh | 6 ++++++
 manifests/tal_cli.pp   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/files/tal/on_update.sh b/files/tal/on_update.sh
index 068b662..4c364f7 100644
--- a/files/tal/on_update.sh
+++ b/files/tal/on_update.sh
@@ -1,5 +1,11 @@
 #!/usr/bin/bash
 
+if [[ $# -gt 0 ]]
+then
+    /home/examadm/tal-cli/on_update.sh | tee /home/examadm/tal-cli/log
+    exit $?
+fi
+
 cd source
 
 python3 -m pip install --user -r scripts/requirements.txt
diff --git a/manifests/tal_cli.pp b/manifests/tal_cli.pp
index ed6610a..777a78d 100644
--- a/manifests/tal_cli.pp
+++ b/manifests/tal_cli.pp
@@ -74,7 +74,7 @@ class aes::tal_cli (
     path        => '/bin:/usr/bin',
     environment => ['HOME=/home/examadm'],
     creates     => '/home/examadm/tal-cli/source/tal',
-    command     => '/home/examadm/tal-cli/on_update.sh | tee /home/examadm/tal-cli/log.txt',
+    command     => '/home/examadm/tal-cli/on_update.sh --log',
     require     => File['/home/examadm/tal-cli/on_update.sh'],
   }
 
-- 
GitLab