live: remove file from cache with no checksum file

Maybe result of a partial download? then, remove it to leave cache in consistent
state.
master
OpenGnSys Support Team 2024-09-02 13:57:31 +02:00
parent f7b37ba010
commit f2a2f53074
1 changed files with 10 additions and 1 deletions

View File

@ -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({