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.
master
Alejandro Sirgo Rica 2024-05-27 10:55:59 +02:00
parent 60803fe0ed
commit dd003e688f
1 changed files with 4 additions and 3 deletions

View File

@ -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):