mirror of https://git.48k.eu/ogclient
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
parent
60803fe0ed
commit
dd003e688f
|
|
@ -14,6 +14,7 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from src.log import OgError
|
from src.log import OgError
|
||||||
|
from src.utils.cache import mount_cache
|
||||||
|
|
||||||
def _compute_md5(path, bs=2**20):
|
def _compute_md5(path, bs=2**20):
|
||||||
m = hashlib.md5()
|
m = hashlib.md5()
|
||||||
|
|
@ -41,9 +42,9 @@ def tip_fetch_csum(tip_addr, image_name):
|
||||||
|
|
||||||
|
|
||||||
def tip_write_csum(image_name):
|
def tip_write_csum(image_name):
|
||||||
"""
|
if not mount_cache():
|
||||||
TODO: Check for CACHE partition
|
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'
|
image_path = f'/opt/opengnsys/cache/opt/opengnsys/images/{image_name}.img'
|
||||||
|
|
||||||
if not os.path.exists(image_path):
|
if not os.path.exists(image_path):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue