From 14e9314809f927cae5e1fb70c88def7c9fbb5cc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20J=C3=BCrges?=
 <4-jurges@users.noreply.git.astron.nl>
Date: Tue, 18 May 2021 16:07:36 +0000
Subject: [PATCH] L2SS-218. Taking Jan David's recommendation in to account

- Replace the set +e/set -e with || true when loading the Tango DB.
- Explain why in the world I am starting dsconfig twice.
---
 bootstrap/sbin/rebuild_system_from_scratch.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bootstrap/sbin/rebuild_system_from_scratch.sh b/bootstrap/sbin/rebuild_system_from_scratch.sh
index 9a651af5b..8840c5a11 100755
--- a/bootstrap/sbin/rebuild_system_from_scratch.sh
+++ b/bootstrap/sbin/rebuild_system_from_scratch.sh
@@ -55,8 +55,12 @@ function start_minimal_tango()
 {
     (cd ${HOME_DIR}/docker-compose
     make minimal
+    # There is an issue with the dsconfig container that it every
+    # other time just exits without telling why.
+    # Therefore start dsconfig, then wait for 10s to allow it
+    # to die and just start it again.
+    # Don't they say that the second time is always a charm?
     make start dsconfig
-    # Just for good measure, wait a moment and start dsconfig again
     echo -e "\tWaiting for dsconfig to settle down..."
     sleep 10
     echo -e "\tDone.\n\tStarting dsconfig again."
@@ -65,10 +69,8 @@ function start_minimal_tango()
 
 function configure_tango_db()
 {
-    # This somehow returns with a non-0 return code.
-    set +e
-    ${HOME_DIR}/sbin/update_ConfigDb.sh ${HOME_DIR}/CDB/LOFAR_ConfigDb.json
-    set -e
+    # This somehow returns with a non-0 return code, make Bash happy.
+    ${HOME_DIR}/sbin/update_ConfigDb.sh ${HOME_DIR}/CDB/LOFAR_ConfigDb.json || true
 }
 
 function configure_elk()
-- 
GitLab