summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-27 10:55:59 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-30 17:22:23 +0200
commitdd003e688fad500bb40210d64b7b96e1ea63b8fa (patch)
treeb38c9fcd09ca8eb498f7c7db31bd8423fb2cebcc /src
parent60803fe0ed3da3efc444b5f4b203f8fe1b16ca33 (diff)
tiptorrent: check cache availability in tip_write_csum
Remove old TODO message. Check if the cache is available before trying to generate an image's checksum.
Diffstat (limited to 'src')
-rw-r--r--src/utils/tiptorrent.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/utils/tiptorrent.py b/src/utils/tiptorrent.py
index 9ed6a65..9715b21 100644
--- a/src/utils/tiptorrent.py
+++ b/src/utils/tiptorrent.py
@@ -14,6 +14,7 @@ import shutil
import subprocess
import urllib.request
from src.log import OgError
+from src.utils.cache import mount_cache
def _compute_md5(path, bs=2**20):
m = hashlib.md5()
@@ -41,9 +42,9 @@ def tip_fetch_csum(tip_addr, image_name):
def tip_write_csum(image_name):
- """
- TODO: Check for CACHE partition
- """
+ if not mount_cache():
+ raise OgError(f'Failed to checksum {image_name}: cache partition is not available')
+
image_path = f'/opt/opengnsys/cache/opt/opengnsys/images/{image_name}.img'
if not os.path.exists(image_path):