summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-03-27 09:58:13 +0100
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-03-27 10:34:22 +0100
commit25b00bfd6985a4d35deed2cc25f2abbd62967b0e (patch)
tree0d9b9d6c04ce2fc0772e1a4df5cf16a4776e4f72 /src
parentc3ce5342c96b8dfbe3cb472f8964963eb07a4959 (diff)
live: use .ant image as main image after image creation error
Restore image file from .ant to original file name if new image creation fails. Remove new imagen and move the .ant image file in place of the original as previously an error meant a rename of the image file without a revert to keep the image available.
Diffstat (limited to 'src')
-rw-r--r--src/live/ogOperations.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index a3df4c8..08c2f5d 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -504,6 +504,12 @@ class OgLiveOperations:
image_info = ogGetImageInfo(image_path)
except Exception as e:
+ if os.path.exists(image_path):
+ os.unlink(image_path)
+
+ if os.path.exists(f'{image_path}.ant'):
+ shutil.move(f'{image_path}.ant', image_path)
+
self._restartBrowser(self._url)
raise RuntimeError(f'Failed to create image for {fstype} filesystem in device {padev}: {e}') from e