From be0d4be5c1c75a6190fb59c4552d8264f304ffb1 Mon Sep 17 00:00:00 2001 From: Agnieszka Kostrzewa Date: Sun, 22 Apr 2012 17:13:42 +0200 Subject: [PATCH] Option to retry pumount if failed. --- qubesmanager/backup_utils.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/qubesmanager/backup_utils.py b/qubesmanager/backup_utils.py index 3c1752c..fbf0923 100644 --- a/qubesmanager/backup_utils.py +++ b/qubesmanager/backup_utils.py @@ -59,16 +59,21 @@ def mount_device(dev_path): return None def umount_device(dev_mount_path): - try: - pumount_cmd = ["pumount", "--luks-force", dev_mount_path] - res = subprocess.check_call(pumount_cmd) - if res == 0: - dev_mount_path = None - except Exception as ex: - QMessageBox.warning (None, "Error unmounting backup device!", "Could not unmount {0}.
\ - Please unmount it manually using
pumount {0}.

\ - ERROR: {1}".format(dev_mount_path, ex)) - return dev_mount_path + while True: + try: + pumount_cmd = ["pumount", "--luks-force", dev_mount_path] + res = subprocess.check_call(pumount_cmd) + if res == 0: + dev_mount_path = None + return dev_mount_path + except Exception as ex: + title = "Error unmounting backup device!" + text = "Could not unmount {0}.
\ + Please retry or unmount it manually using
pumount {0}.

\ + ERROR: {1}".format(dev_mount_path, ex) + button = QMessageBox.warning (None, title, text, QMessageBox.Ok | QMessageBox.Retry, QMessageBox.Retry) + if button == QMessageBox.Ok: + return dev_mount_path def fill_devs_list(dialog):