diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-09-02 13:57:31 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-09-02 13:59:36 +0200 |
commit | f2a2f5307464448989ff4b276f8ce5cee5c66b03 (patch) | |
tree | 8ecb70f1ad25493212fc7b0f830503bb8dd96273 /src/live/ogOperations.py | |
parent | f7b37ba0100b7366c65100ca8f3b6788eb68d7c5 (diff) |
live: remove file from cache with no checksum file
Maybe result of a partial download? then, remove it to leave cache in consistent
state.
Diffstat (limited to 'src/live/ogOperations.py')
-rw-r--r-- | src/live/ogOperations.py | 11 |
1 files changed, 10 insertions, 1 deletions
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({ |