diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-03-17 15:47:09 +0100 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-03-18 10:24:01 +0100 |
commit | cc52bc61bf372a0fcc52988542bac0cfd75d9bf2 (patch) | |
tree | e7cc8c5f5011825707becbfd201ee359357fc3ef /client/engine/Image.lib | |
parent | 86efae55d50cd80b644b9b9e0b296d1e52697ef5 (diff) |
#1062 Check tiptorrent exit code
Otherwise, the image restoration continues in failed downloads.
Diffstat (limited to 'client/engine/Image.lib')
-rwxr-xr-x | client/engine/Image.lib | 12 |
1 files 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" |