From 399a5dceb8730314f651973a0e2ac13a7fab3efa Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Thu, 6 Jun 2024 17:13:24 +0200 Subject: live: handle no cache in tiptorrent and unicast restore 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. --- src/live/ogOperations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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' -- cgit v1.2.3-18-g5258