live: validate file existence and checksum for unicast cache

after copying file to cache, validate that file exists in cache and checksum
correct.
master
OpenGnSys Support Team 2024-07-29 23:30:24 +02:00
parent 210a70fc73
commit 8395982244
1 changed files with 5 additions and 0 deletions

View File

@ -208,6 +208,11 @@ class OgLiveOperations:
if (not os.path.exists(image_path) or
not tip_check_csum(repo, name)):
self._copy_image_to_cache(name)
if (not os.path.exists(image_path)):
raise OgError(f'could not find {image_path} in cache')
if (not tip_check_csum(repo, name)):
raise OgError(f'Failed to validate checksum for {name}.img')
else:
if os.access(f'/opt/opengnsys/images', os.R_OK) == False:
raise OgError('Cannot access /opt/opengnsys/images in read mode, check permissions')