diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-08-12 10:47:56 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-08-21 09:21:53 +0200 |
commit | 19e8825805cfd0d951a9c3657726fdd2855b639f (patch) | |
tree | 32e67c238661a6ce4722ec0c0441fc6ab473a91e | |
parent | 1ca3992f719f3a1f581c9253f061d76338137e7a (diff) |
utils: return False instead of rising exception
if image file and checksum are not found in the cache, then report checksum
validation has failed so it can proceed to fetch new files from server.
-rw-r--r-- | src/utils/tiptorrent.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/utils/tiptorrent.py b/src/utils/tiptorrent.py index 14ede8b..1aa1a6a 100644 --- a/src/utils/tiptorrent.py +++ b/src/utils/tiptorrent.py @@ -80,9 +80,11 @@ def tip_check_csum(tip_addr, image_name): logging.info(f'Verifying checksum for {image_name}.img, please wait...') image_path = f'{OG_CACHE_IMAGE_PATH}{image_name}.img' if not os.path.exists(image_path): - raise OgError(f'File {image_path} does not exist') + logging.error(f'File {image_path} does not exist') + return False if not os.path.exists(f"{image_path}.full.sum"): - raise OgError(f'File {image_path}.full.sum does not exist in repository {tip_addr}') + logging.error(f'File {image_path}.full.sum does not exist in repository {tip_addr}') + return False cache_csum = _tip_read_csum(f"{image_path}.full.sum") remote_csum = tip_fetch_csum(tip_addr, image_name) |