From cc52bc61bf372a0fcc52988542bac0cfd75d9bf2 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 17 Mar 2022 15:47:09 +0100 Subject: #1062 Check tiptorrent exit code Otherwise, the image restoration continues in failed downloads. --- client/engine/Image.lib | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/engine/Image.lib b/client/engine/Image.lib index 75541dca..728eb24a 100755 --- a/client/engine/Image.lib +++ b/client/engine/Image.lib @@ -104,7 +104,7 @@ esac function ogTiptorrentGet () { -local MAXTRIES +local MAXTRIES err i=0 MAXTRIES=3 while [ "$i" -lt $MAXTRIES ] @@ -118,8 +118,12 @@ if [ $i -eq 3 ]; then fi pushd /opt/opengnsys/cache/opt/opengnsys/images > /dev/null || return 1 /opt/opengnsys/bin/tiptorrent-client "$ogrepo" "$1" > /dev/null +err=$? popd > /dev/null || return 1 -return $? +if [ $err -ne 0 ]; then + ogRaiseError "$OG_ERR_NOTFOUND" "Error downloading $1 image, tiptorrent-client failed. See /var/log/syslog on the client for details." +fi +return $err } function ogTiptorrentGetToCache () @@ -130,7 +134,9 @@ if ! wget -qO "$1".full.sum "$ogrepo:9999/$2.full.sum"; then return $? fi MD5FILE=$(cat "$1".full.sum) -ogTiptorrentGet "$2" +if ! ogTiptorrentGet "$2"; then + return 1; +fi MD5IMG=$(md5sum "$IMGPATH" | cut -f1 -d " ") if [ "$MD5IMG" != "$MD5FILE" ]; then ogRaiseError "$OG_ERR_NOTFOUND" "Error downloading $2, checksum mismatch" -- cgit v1.2.3-18-g5258