summaryrefslogtreecommitdiffstats
path: root/src/live/ogOperations.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-06 17:13:24 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-07 10:09:50 +0200
commit399a5dceb8730314f651973a0e2ac13a7fab3efa (patch)
tree383d728f424c4b90a48d3abd2a70f58767362001 /src/live/ogOperations.py
parentec132cfb9510149b9138c30d02d9597ff14bccea (diff)
live: handle no cache in tiptorrent and unicast restorev1.3.2-11
Properly report the lack of cache partition when restoring an image using TIPTORRENT and UNICAST as methods. Abort any restore in case of no cache partition.
Diffstat (limited to 'src/live/ogOperations.py')
-rw-r--r--src/live/ogOperations.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index d98568f..733beae 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -193,6 +193,9 @@ class OgLiveOperations:
raise OgError(f'Cannot change repository to {repo}')
if cache:
+ if not get_cache_dev_path():
+ raise OgError('No cache partition is mounted')
+
image_path = f'{OG_CACHE_IMAGE_PATH}{name}.img'
if (not os.path.exists(image_path) or
not tip_check_csum(repo, name)):
@@ -202,7 +205,7 @@ class OgLiveOperations:
self._restore_image(image_path, devpath)
def _restore_image_tiptorrent(self, repo, name, devpath):
- if not os.path.exists(OG_CACHE_IMAGE_PATH):
+ if not get_cache_dev_path():
raise OgError('No cache partition is mounted')
image_path = f'{OG_CACHE_IMAGE_PATH}{name}.img'