summaryrefslogtreecommitdiffstats
path: root/src/virtual/ogOperations.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-27 10:27:57 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-30 17:22:23 +0200
commit72d8943576610395582f95b170730bae4adf2287 (patch)
treedf00f91a2ab7302457948df927a6dd5d7c9e5b14 /src/virtual/ogOperations.py
parent8de2b785a9be79f9cc0caa0011293f95a42d4d31 (diff)
virtual: handle copy error in image restore
Add a proper error report for the shutil.copy operation in image_restore() instead of silently returning.
Diffstat (limited to 'src/virtual/ogOperations.py')
-rw-r--r--src/virtual/ogOperations.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/virtual/ogOperations.py b/src/virtual/ogOperations.py
index 2b69fd1..d40170e 100644
--- a/src/virtual/ogOperations.py
+++ b/src/virtual/ogOperations.py
@@ -449,9 +449,10 @@ class OgVirtualOperations:
subprocess.run([cmd], shell=True, check=True)
try:
- shutil.copy(f'{self.OG_IMAGES_PATH}/{name}', drive_path)
- except:
- return None
+ copy_src = f'{self.OG_IMAGES_PATH}/{name}'
+ shutil.copy(copy_src, drive_path)
+ except Exception as e:
+ raise OgError(f'Error trying to copy {copy_src} into {drive_path}: {e}') from e
subprocess.run([f'umount {self.OG_IMAGES_PATH}'], shell=True)
self.refresh(ogRest)