diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-14 16:12:28 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-02-15 16:22:13 +0100 |
commit | 6b1f20faf326e5b9558060cdf07a347854e6dafc (patch) | |
tree | 618185f32b03a40dd3a0ee1c04acd6bba81fec50 /src/live | |
parent | 478c4447be20380c5b173f8e150d2373cf6d021b (diff) |
live: log message improvements for image creation and restore
Provide more context information for debugging issues with image creation and
restore.
Diffstat (limited to 'src/live')
-rw-r--r-- | src/live/ogOperations.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index b24a23c..93836f7 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -164,7 +164,13 @@ class OgLiveOperations: tip_client_get(repo, name) except: self._restartBrowser(self._url) - raise ValueError('Error before restoring image') + if (not os.path.exists(image_path)): + raise ValueError(f'Image file {image_path} does not exist') + if (not tip_check_csum(repo, name)): + raise ValueError(f'checksum file {name}.full.sum is missing in repository {repo}') + + raise ValueError(f'Unexpected error when restoring image file {image_path}') + self._restore_image(image_path, devpath) def _restore_image(self, image_path, devpath): @@ -432,13 +438,13 @@ class OgLiveOperations: if pa is None: self._restartBrowser(self._url) - logging.error('Target partition not found') - raise ValueError('Target partition number not found') + logging.error(f'Target partition /dev/{diskname} not found') + raise ValueError(f'Target partition /dev/{diskname} not found') padev = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_DEVICE) fstype = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_FSTYPE) if not fstype: - logging.error('No filesystem detected. Aborting image creation.') + logging.error(f'No filesystem detected in {padev}. Aborting image creation.') raise ValueError('Target partition has no filesystem present') if change_access(user=self._smb_user, pwd=self._smb_pass) == -1: @@ -454,7 +460,7 @@ class OgLiveOperations: ogCopyEfiBootLoader(disk, partition) if ogReduceFs(disk, partition) == -1: - logging.error('Failed to shrink filesystem') + logging.error(f'Failed to shrink {fstype} filesystem in {padev}') raise ValueError('Failed to shrink filesystem') cmd1 = shlex.split(f'partclone.{fstype} -I -C --clone -s {padev} -O -') @@ -469,7 +475,7 @@ class OgLiveOperations: p2 = Popen(cmd2, stdin=p1.stdout) p1.stdout.close() - logging.info(f'Running image creation process, please do not shut down or reboot the client') + logging.info(f'Creating image at {image_path} from {padev} using {fstype}, please do not shut down or reboot the client') try: retdata = p2.communicate() |