diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-03-07 13:07:03 +0100 |
---|---|---|
committer | lupoDharkael <izhe@hotmail.es> | 2024-03-21 10:29:06 +0100 |
commit | 37600660f3ec54d9221c76d3de72f64cb6de85fc (patch) | |
tree | d8b63244d81c234314077e35caf0c6e3cafc6b2d | |
parent | 52ab38fc28abcad001de995cbcec3ce23094b507 (diff) |
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.
-rw-r--r-- | src/live/ogOperations.py | 4 |
1 files changed, 4 insertions, 0 deletions
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 |