diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-06-27 11:40:37 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-06-27 11:46:30 +0200 |
commit | a9d8cdd210234b2d295c7a3e342cf2bd3f48f45f (patch) | |
tree | 028f4d67338662eab8241a917d84fbfe2715df7e /src/utils | |
parent | 6282cb41a8d3dac4995432baee1e25056a30909b (diff) |
live: revisit error log when failing to validate checksum
Add explicit check for .full.sum after downloading it.
Rewrite errors log, one of them is misleading when checksum validation
fails, it refers to missing .full.sum, but it could be a different
reason.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/tiptorrent.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/tiptorrent.py b/src/utils/tiptorrent.py index d3e95f4..8fc1631 100644 --- a/src/utils/tiptorrent.py +++ b/src/utils/tiptorrent.py @@ -67,11 +67,14 @@ 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'Invalid image path {image_path} for tiptorrent image csum comparison') + raise OgError(f'File {image_path} does not exist') cache_csum = _compute_md5(image_path) remote_csum = tip_fetch_csum(tip_addr, image_name) + 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}') + if cache_csum == remote_csum: ret = True logging.info(f'Checksum is OK for {image_name}.img') |