mirror of https://git.48k.eu/ogclient
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
parent
f7b37ba010
commit
f2a2f53074
|
@ -139,7 +139,16 @@ class OgLiveOperations:
|
||||||
logging.error(f'Cannot read checksum file {checksum_file_path}: {e}')
|
logging.error(f'Cannot read checksum file {checksum_file_path}: {e}')
|
||||||
|
|
||||||
if not image_checksum:
|
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
|
image_size = os.stat(file_path).st_size
|
||||||
cache_contents.append({
|
cache_contents.append({
|
||||||
|
|
Loading…
Reference in New Issue