utils: add error checks to checksum file creation in tip_write_csum

Add a check for potential permission or IO errors during the
creation of the image checksum.
master
Alejandro Sirgo Rica 2024-05-07 17:03:26 +02:00 committed by lupoDharkael
parent abea6583d3
commit 6bfbf6cc7b
1 changed files with 5 additions and 2 deletions

View File

@ -51,8 +51,11 @@ def tip_write_csum(image_name):
filename = image_path + ".full.sum" filename = image_path + ".full.sum"
csum = _compute_md5(image_path) csum = _compute_md5(image_path)
with open(filename, 'w') as f: try:
f.write(csum) with open(filename, 'w') as f:
f.write(csum)
except OSError as e:
raise OgError(f'Could not write {filename}, reported: {e}') from e
return csum return csum