mirror of https://git.48k.eu/ogclient
fs: check if writing md5sum to full.sum file fails
writing to file might fail (permission denied, disk full), check for errors.master
parent
8fb8a0a66d
commit
2da8b98fff
|
@ -122,8 +122,14 @@ class OgLiveOperations:
|
|||
raise ValueError('Invalid image path when computing md5 checksum')
|
||||
filename = path + ".full.sum"
|
||||
dig = self._compute_md5(path)
|
||||
with open(filename, 'w') as f:
|
||||
f.write(dig)
|
||||
try:
|
||||
with open(filename, 'w') as f:
|
||||
f.write(dig)
|
||||
except:
|
||||
logging.error(f'cannot write {filename}')
|
||||
return -1
|
||||
|
||||
return 0
|
||||
|
||||
def _copy_image_to_cache(self, image_name):
|
||||
"""
|
||||
|
@ -515,7 +521,9 @@ class OgLiveOperations:
|
|||
image_info.perms = perms
|
||||
image_info.mtime = mtime
|
||||
|
||||
self._write_md5_file(f'/opt/opengnsys/images/{name}.img')
|
||||
if self._write_md5_file(f'/opt/opengnsys/images/{name}.img') == -1:
|
||||
logging.error(f'cannot write {name}.full.sum file')
|
||||
raise ValueError(f'Error: Cannot write {name}.full.sum file')
|
||||
|
||||
self._restartBrowser(self._url)
|
||||
|
||||
|
|
Loading…
Reference in New Issue