aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2021-01-01 21:57:34 +0100
committerPapoteur <papoteur@mageia.org>2021-01-01 21:57:34 +0100
commitfb45e4177862b407e45753d0390bbcd1eb0278b9 (patch)
tree1918b247e82ca7dd35f1b76e0339f83936a7334d /lib
parenta6368e5c2cfe9e50051418df2ed93a2410ec6143 (diff)
downloadisodumper-fb45e4177862b407e45753d0390bbcd1eb0278b9.tar
isodumper-fb45e4177862b407e45753d0390bbcd1eb0278b9.tar.gz
isodumper-fb45e4177862b407e45753d0390bbcd1eb0278b9.tar.bz2
isodumper-fb45e4177862b407e45753d0390bbcd1eb0278b9.tar.xz
isodumper-fb45e4177862b407e45753d0390bbcd1eb0278b9.zip
Manage error when partition is busy and trying to unmount
Diffstat (limited to 'lib')
-rwxr-xr-xlib/isodumper.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 4c3fa6b..f164547 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -127,7 +127,13 @@ class UDisks2(object):
iface = self.bus.get(self.SERVICE, path_to_encrypted)
fs = iface[self.SERVICE + '.Filesystem']
if fs.MountPoints: # partition is mounted
- fs.Unmount({})
+ try:
+ fs.Unmount({})
+ except GLib.GError as e:
+ print(str(e))
+ return False, _("A partition is busy. Try to free it before starting again.")
+ except:
+ raise Exception(str(e))
iface = self.bus.get(self.SERVICE, block['path'])
fs = iface[self.SERVICE + '.Encrypted']
fs.Lock({})
@@ -138,7 +144,13 @@ class UDisks2(object):
fs = iface[self.SERVICE + '.Filesystem']
if fs.MountPoints: # partition is mounted
logging.debug(f"Unmounting {block['path']}")
- fs.Unmount({})
+ try:
+ fs.Unmount({})
+ except GLib.GError as e:
+ print(str(e))
+ return False, _("A partition is busy. Try to free it before starting again.")
+ except:
+ raise Exception(str(e))
else:
logging.debug(f"Not mounted {block['path']}")
return True, ""