From f2a2f5307464448989ff4b276f8ce5cee5c66b03 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Mon, 2 Sep 2024 13:57:31 +0200 Subject: live: remove file from cache with no checksum file Maybe result of a partial download? then, remove it to leave cache in consistent state. --- src/live/ogOperations.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index df0c2e1..5b55422 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -139,7 +139,16 @@ class OgLiveOperations: logging.error(f'Cannot read checksum file {checksum_file_path}: {e}') if not image_checksum: - logging.error(f'Empty checksum for image {file_name}') + logging.info(f'Removing {file_name} with no checksum file from cache, maybe partial download?') + try: + if os.path.exists(file_path): + os.unlink(file_path) + if os.path.exists(checksum_file_path): + os.unlink(checksum_file_path) + except OSError as e: + pass + + continue image_size = os.stat(file_path).st_size cache_contents.append({ -- cgit v1.2.3-18-g5258