summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-07 17:03:26 +0200
committerlupoDharkael <izhe@hotmail.es>2024-05-07 20:47:05 +0200
commit6bfbf6cc7b8b5425eb8922769755a6c1cc2fb376 (patch)
treec3a337fe9843a2fca27e9d82cf4ccfd744eaca45 /src
parentabea6583d3d9cef9b1187e9fcfdfc1bb4bfcce25 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/utils/tiptorrent.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/utils/tiptorrent.py b/src/utils/tiptorrent.py
index 1d628c1..9ed6a65 100644
--- a/src/utils/tiptorrent.py
+++ b/src/utils/tiptorrent.py
@@ -51,8 +51,11 @@ def tip_write_csum(image_name):
filename = image_path + ".full.sum"
csum = _compute_md5(image_path)
- with open(filename, 'w') as f:
- f.write(csum)
+ try:
+ 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