From ab3811c43a5c2d80a9b12ba6c363abc64aad85e1 Mon Sep 17 00:00:00 2001 From: Tesshu Flower Date: Tue, 28 Nov 2023 14:58:02 -0500 Subject: [PATCH] restic restore run cmd separately to capture error Signed-off-by: Tesshu Flower --- mover-restic/entry.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mover-restic/entry.sh b/mover-restic/entry.sh index 4fb2e7827..5870d538f 100755 --- a/mover-restic/entry.sh +++ b/mover-restic/entry.sh @@ -182,6 +182,11 @@ function select_restic_snapshot_to_restore() { # create an associative array that maps numeric epoch to the restic snapshot IDs declare -A epochs_to_snapshots + local restic_snapshots + if ! restic_snapshots=$("${RESTIC[@]}" -r "${RESTIC_REPOSITORY}" snapshots); then + error 3 "failure getting list of snapshots from repository" + fi + # declare vars to be used in the loop local snapshot_id local snapshot_ts @@ -190,7 +195,7 @@ function select_restic_snapshot_to_restore() { # go through the timestamps received from restic IFS=$'\n' - for line in $("${RESTIC[@]}" -r "${RESTIC_REPOSITORY}" snapshots | grep /data | awk '{print $1 "\t" $2 " " $3}'); do + for line in $(echo -e "${restic_snapshots}" | grep /data | awk '{print $1 "\t" $2 " " $3}'); do # extract the proper variables snapshot_id=$(echo -e "${line}" | cut -d$'\t' -f1) snapshot_ts=$(echo -e "${line}" | cut -d$'\t' -f2)