qubes-manager: Bug fixes for backup/restore dialog around pumount usage

* pumount was not being called with sudo
* pumount cleans up mount_dir, therefore rmdir removed
* check for NoneType when setting dir_line_edit to avoid exception
This commit is contained in:
Bruce A Downs 2012-10-15 16:42:02 -06:00 committed by Marek Marczykowski
parent 1026d19340
commit a64aab0acf

View File

@ -61,11 +61,9 @@ def mount_device(dev_path):
def umount_device(dev_mount_path): def umount_device(dev_mount_path):
while True: while True:
try: try:
pumount_cmd = ["pumount", "--luks-force", dev_mount_path] pumount_cmd = ["sudo", "pumount", "--luks-force", dev_mount_path]
res = subprocess.check_call(pumount_cmd) res = subprocess.check_call(pumount_cmd)
if res == 0: if res == 0:
if dev_mount_path.startswith('/media/backup'):
os.rmdir(dev_mount_path)
dev_mount_path = None dev_mount_path = None
return dev_mount_path return dev_mount_path
except Exception as ex: except Exception as ex:
@ -145,9 +143,12 @@ def dev_combobox_activated(dialog, idx):
return return
dialog.prev_dev_idx = idx dialog.prev_dev_idx = idx
# Initialize path with root of mounted device
dialog.dir_line_edit.setText(dialog.dev_mount_path) if dialog.dev_mount_path != None:
dialog.backup_dir = dialog.dev_mount_path # Initialize path with root of mounted device
dialog.dir_line_edit.setText(dialog.dev_mount_path)
dialog.backup_dir = dialog.dev_mount_path
dialog.select_dir_page.emit(SIGNAL("completeChanged()")) dialog.select_dir_page.emit(SIGNAL("completeChanged()"))