From d6705b12b9d2caf67e0985818918fbddfbc52337 Mon Sep 17 00:00:00 2001 From: Steffen Bleul Date: Sat, 27 Oct 2018 12:26:55 +0200 Subject: [PATCH] #57 Collect and return error codes from duplicity commands. --- buildscripts/release.sh | 2 +- scripts/backup | 9 ++++++++- scripts/backupFull | 9 ++++++++- scripts/backupIncremental | 9 ++++++++- scripts/periodicBackup | 9 ++++++++- scripts/restore | 9 ++++++++- 6 files changed, 41 insertions(+), 6 deletions(-) diff --git a/buildscripts/release.sh b/buildscripts/release.sh index 2adc4221..cf516862 100755 --- a/buildscripts/release.sh +++ b/buildscripts/release.sh @@ -3,5 +3,5 @@ #------------------ # CONTAINER VARIABLES #------------------ -export IMAGE_VERSION=1.3.2 +export IMAGE_VERSION=1.4.2 export BUILD_BRANCH=$(git branch | grep -e "^*" | cut -d' ' -f 2) diff --git a/scripts/backup b/scripts/backup index 8362221d..2280b999 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,8 +6,15 @@ set -o errexit source /opt/volumerize/base.sh +DUPLICITY_RETURN_CODE=0 + +function backup() { + ${DUPLICITY_COMMAND} $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || DUPLICITY_RETURN_CODE=$? && true ; +} + ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy preAction backup source ${VOLUMERIZE_SCRIPT_DIR}/stopContainers.sh -${DUPLICITY_COMMAND} $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || true +backup $@ source ${VOLUMERIZE_SCRIPT_DIR}/startContainers.sh ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy postAction backup +exit $DUPLICITY_RETURN_CODE diff --git a/scripts/backupFull b/scripts/backupFull index 129ae026..58e333b0 100755 --- a/scripts/backupFull +++ b/scripts/backupFull @@ -6,8 +6,15 @@ set -o errexit source /opt/volumerize/base.sh +DUPLICITY_RETURN_CODE=0 + +function backupFull() { + ${DUPLICITY_COMMAND} full $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || DUPLICITY_RETURN_CODE=$? && true ; +} + ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy preAction backup source ${VOLUMERIZE_SCRIPT_DIR}/stopContainers.sh -${DUPLICITY_COMMAND} full $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || true +backupFull $@ source ${VOLUMERIZE_SCRIPT_DIR}/startContainers.sh ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy postAction backup +exit $DUPLICITY_RETURN_CODE diff --git a/scripts/backupIncremental b/scripts/backupIncremental index cc0073d5..30bbabbe 100755 --- a/scripts/backupIncremental +++ b/scripts/backupIncremental @@ -6,8 +6,15 @@ set -o errexit source /opt/volumerize/base.sh +DUPLICITY_RETURN_CODE=0 + +function backupIncremental() { + ${DUPLICITY_COMMAND} incremental $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || DUPLICITY_RETURN_CODE=$? && true ; +} + ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy preAction backup source ${VOLUMERIZE_SCRIPT_DIR}/stopContainers.sh -${DUPLICITY_COMMAND} incremental $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || true +backupIncremental $@ source ${VOLUMERIZE_SCRIPT_DIR}/startContainers.sh ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy postAction backup +exit $DUPLICITY_RETURN_CODE diff --git a/scripts/periodicBackup b/scripts/periodicBackup index 495fa1de..50cadd0f 100755 --- a/scripts/periodicBackup +++ b/scripts/periodicBackup @@ -6,8 +6,15 @@ set -o errexit source /opt/volumerize/base.sh +DUPLICITY_RETURN_CODE=0 + +function periodicBackup() { + ${DUPLICITY_COMMAND} $@ ${DUPLICITY_MODE} ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} || DUPLICITY_RETURN_CODE=$? && true ; +} + ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy preAction backup source ${VOLUMERIZE_SCRIPT_DIR}/stopContainers.sh -${DUPLICITY_COMMAND} $@ ${DUPLICITY_MODE} ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_SOURCE} ${VOLUMERIZE_TARGET} +periodicBackup $@ source ${VOLUMERIZE_SCRIPT_DIR}/startContainers.sh ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy postAction backup +exit $DUPLICITY_RETURN_CODE diff --git a/scripts/restore b/scripts/restore index d3272bfe..fd8312f3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,8 +6,15 @@ set -o errexit source /opt/volumerize/base.sh +DUPLICITY_RETURN_CODE=0 + +function restore() { + ${DUPLICITY_COMMAND} restore --force $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_TARGET} ${VOLUMERIZE_SOURCE} || DUPLICITY_RETURN_CODE=$? && true ; +} + ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy preAction restore source ${VOLUMERIZE_SCRIPT_DIR}/stopContainers.sh -${DUPLICITY_COMMAND} restore --force $@ ${DUPLICITY_OPTIONS} ${VOLUMERIZE_INCUDES} ${VOLUMERIZE_TARGET} ${VOLUMERIZE_SOURCE} || true +restore $@ source ${VOLUMERIZE_SCRIPT_DIR}/startContainers.sh ${VOLUMERIZE_SCRIPT_DIR}/prepoststrategy postAction restore +exit $DUPLICITY_RETURN_CODE