From 1e9192219316173642fa7c075f4fe7439d62b15e Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 6 Oct 2021 19:49:18 +0200
Subject: [PATCH] L2SS-394: Check if the copy actually succeeds before using
 its result

---
 sbin/load_ConfigDb.sh   | 5 ++++-
 sbin/update_ConfigDb.sh | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sbin/load_ConfigDb.sh b/sbin/load_ConfigDb.sh
index e62092969..03ab449a0 100755
--- a/sbin/load_ConfigDb.sh
+++ b/sbin/load_ConfigDb.sh
@@ -9,7 +9,10 @@ fi
 
 # copy file into container to read it from container, as the file's location
 # in the container won't be the same as on the host.
-docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json
+docker cp "${file}" dsconfig:/tmp/dsconfig-load-settings.json || exit 1
 
 # write settings
 docker exec -it dsconfig json2tango --write /tmp/dsconfig-load-settings.json
+
+# somehow json2tango does not return 0 on success
+exit 0
diff --git a/sbin/update_ConfigDb.sh b/sbin/update_ConfigDb.sh
index 90cf92c24..8d71c312f 100755
--- a/sbin/update_ConfigDb.sh
+++ b/sbin/update_ConfigDb.sh
@@ -9,7 +9,10 @@ fi
 
 # copy file into container to read it from container, as the file's location
 # in the container won't be the same as on the host.
-docker cp "${file}" dsconfig:/tmp/dsconfig-update-settings.json
+docker cp "${file}" dsconfig:/tmp/dsconfig-update-settings.json || exit 1
 
 # update settings
 docker exec -it dsconfig json2tango --write --update /tmp/dsconfig-update-settings.json
+
+# somehow json2tango does not return 0 on success
+exit 0
-- 
GitLab