From 37600660f3ec54d9221c76d3de72f64cb6de85fc Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 7 Mar 2024 13:07:03 +0100 Subject: live: check if cache partition is available before calling tiptorrent The image restore command must check if the cache partition is available. Otherwise if the user forgets to create the cache tiptorrent fails. --- src/live/ogOperations.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 815211f..339c58c 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -40,6 +40,7 @@ from src.ogClient import ogClient from src.utils.probe import OSFamily, get_os_family OG_SHELL = '/bin/bash' +OG_CACHE_PATH = '/opt/opengnsys/cache/opt/opengnsys/images' class OgLiveOperations: def __init__(self, config): @@ -166,6 +167,9 @@ class OgLiveOperations: self._restore_image(image_path, devpath) def _restore_image_tiptorrent(self, repo, name, devpath): + if not os.path.exists(OG_CACHE_PATH): + raise RuntimeError('No cache partition is mounted') + image_path = f'/opt/opengnsys/cache/opt/opengnsys/images/{name}.img' try: if (not os.path.exists(image_path) or -- cgit v1.2.3-18-g5258