summaryrefslogtreecommitdiffstats
path: root/src/live/ogOperations.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-02-14 12:20:46 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-02-14 12:28:28 +0100
commit478c4447be20380c5b173f8e150d2373cf6d021b (patch)
tree20a498b81f8dfa0073606388b46161fb2b6983d4 /src/live/ogOperations.py
parentc1529c5eec2d782a38e07077388e780970788ffe (diff)
src: improve error check in image_create and image_restore
cover more error cases where exceptions need to be raised. check return code in the invoked subprocess. restoreImageCustom has been intentionally left behind, it is unclear what this custom script returns on success and error.
Diffstat (limited to 'src/live/ogOperations.py')
-rw-r--r--src/live/ogOperations.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index e19a788..b24a23c 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -441,7 +441,9 @@ class OgLiveOperations:
logging.error('No filesystem detected. Aborting image creation.')
raise ValueError('Target partition has no filesystem present')
- cambiar_acceso(user=self._smb_user, pwd=self._smb_pass)
+ if change_access(user=self._smb_user, pwd=self._smb_pass) == -1:
+ logging.error('remount of /opt/opengnsys/images has failed')
+ raise AssertionError('remount of /opt/opengnsys/images has failed')
if os.access(f'/opt/opengnsys/images', os.R_OK | os.W_OK) == False:
logging.error('Cannot access /opt/opengnsys/images in read and write mode, check permissions')
@@ -451,7 +453,9 @@ class OgLiveOperations:
logging.info(f'image file {image_path} already exists, updating.')
ogCopyEfiBootLoader(disk, partition)
- ogReduceFs(disk, partition)
+ if ogReduceFs(disk, partition) == -1:
+ logging.error('Failed to shrink filesystem')
+ raise ValueError('Failed to shrink filesystem')
cmd1 = shlex.split(f'partclone.{fstype} -I -C --clone -s {padev} -O -')
cmd2 = shlex.split(f'lzop -1 -fo {image_path}')