mirror of https://git.48k.eu/ogclient
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.master
parent
52ab38fc28
commit
37600660f3
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue