mirror of https://git.48k.eu/ogclient
live: clean files after a failed cache image copy
Remove image files after a failed image copy operation.master
parent
73ecb48113
commit
9fa4a5f651
|
@ -208,6 +208,13 @@ class OgLiveOperations:
|
|||
r = shutil.copy(src, dst)
|
||||
tip_write_csum(image_name)
|
||||
except (OSError, OgError) as e:
|
||||
try:
|
||||
if os.path.exists(dst):
|
||||
os.unlink(dst)
|
||||
if os.path.exists(f"{dst}.full.sum"):
|
||||
os.unlink(f"{dst}.full.sum")
|
||||
except OSError as e:
|
||||
pass
|
||||
raise OgError(f'Error copying image {image_name} to cache. Reported: {e}') from e
|
||||
|
||||
if (not os.path.exists(dst)):
|
||||
|
|
Loading…
Reference in New Issue