live: revisit logging for checksum file creation

Add logging before calculating checksum to provide a hint to user on what is
going on while ogClient is still busy.
master v1.3.2-9
OpenGnSys Support Team 2024-05-31 17:20:39 +02:00
parent 914bd993fc
commit d732a214bf
1 changed files with 8 additions and 4 deletions

View File

@ -160,14 +160,15 @@ class OgLiveOperations:
def _write_md5_file(self, path):
if not os.path.exists(path):
raise OgError(f'Invalid image path {path} when computing md5 checksum')
raise OgError(f'Failed to calculate checksum, image file {path} does not exist')
filename = path + ".full.sum"
dig = self._compute_md5(path)
try:
with open(filename, 'w') as f:
f.write(dig)
except:
logging.error(f'cannot write {filename}')
logging.error(f'Cannot write checksum {filename}')
return -1
return 0
@ -470,12 +471,12 @@ class OgLiveOperations:
self._ogbrowser_clear_logs()
self._restartBrowser(self._url_log)
logging.info(f'Request to create image {name}.img at repository {repo}')
if ogChangeRepo(repo, smb_user=self._smb_user, smb_pass=self._smb_pass) != 0:
self._restartBrowser(self._url)
raise OgError(f'Cannot change image repository to {repo}')
logging.info(f'Request to create image {name}.img at repository {repo}')
if ogRest.terminated:
return
@ -560,6 +561,9 @@ class OgLiveOperations:
else:
raise
logging.info(f'Writing checksum file {name}.img.full.sum...')
logging.info('*DO NOT REBOOT OR POWEROFF* the client during this time')
if self._write_md5_file(f'/opt/opengnsys/images/{name}.img') == -1:
raise OgError(f'Cannot write {name}.full.sum file')