Fix erroneous usage of 'qubes' module
On the client side it should use only 'qubesadmin'. In practice, those few are trivial to replace: - get_disk_usage() is also available in shutil (as disk_usage()) - BackupCancelledError should be used from qubesadmin.exc anyway (there was also a typo) Remove also test-packages/qubes to let pylint detect such issues in the future. QubesOS/qubes-issues#5403
This commit is contained in:
parent
563f4d0aec
commit
7bdcb23fb8
@ -23,7 +23,6 @@
|
|||||||
import signal
|
import signal
|
||||||
from qubesadmin import exc
|
from qubesadmin import exc
|
||||||
from qubesadmin import utils as admin_utils
|
from qubesadmin import utils as admin_utils
|
||||||
from qubes.storage.file import get_disk_usage
|
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets # pylint: disable=import-error
|
from PyQt5 import QtCore, QtWidgets # pylint: disable=import-error
|
||||||
from . import ui_backupdlg # pylint: disable=no-name-in-module
|
from . import ui_backupdlg # pylint: disable=no-name-in-module
|
||||||
@ -35,6 +34,7 @@ from . import utils
|
|||||||
import grp
|
import grp
|
||||||
import pwd
|
import pwd
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
@ -202,7 +202,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
|
|||||||
if vm.qid == 0:
|
if vm.qid == 0:
|
||||||
local_user = grp.getgrnam('qubes').gr_mem[0]
|
local_user = grp.getgrnam('qubes').gr_mem[0]
|
||||||
home_dir = pwd.getpwnam(local_user).pw_dir
|
home_dir = pwd.getpwnam(local_user).pw_dir
|
||||||
self.size = get_disk_usage(home_dir)
|
self.size = shutil.disk_usage(home_dir)[1]
|
||||||
else:
|
else:
|
||||||
self.size = vm.get_disk_utilization()
|
self.size = vm.get_disk_utilization()
|
||||||
super(BackupVMsWindow.VmListItem, self).__init__(
|
super(BackupVMsWindow.VmListItem, self).__init__(
|
||||||
|
@ -26,8 +26,6 @@ import os.path
|
|||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
||||||
from qubes import backup
|
|
||||||
|
|
||||||
from . import ui_restoredlg # pylint: disable=no-name-in-module
|
from . import ui_restoredlg # pylint: disable=no-name-in-module
|
||||||
from . import multiselectwidget
|
from . import multiselectwidget
|
||||||
from . import backup_utils
|
from . import backup_utils
|
||||||
@ -53,7 +51,7 @@ class RestoreThread(QtCore.QThread):
|
|||||||
try:
|
try:
|
||||||
self.backup_restore.restore_do(self.vms_to_restore)
|
self.backup_restore.restore_do(self.vms_to_restore)
|
||||||
|
|
||||||
except backup.BackupCanceledError as ex:
|
except exc.BackupCancelledError as ex:
|
||||||
self.canceled = True
|
self.canceled = True
|
||||||
err_msg.append(str(ex))
|
err_msg.append(str(ex))
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
class BackupCanceledError(BaseException):
|
|
||||||
|
|
||||||
tmpdir = None
|
|
||||||
|
|
||||||
pass
|
|
@ -1 +0,0 @@
|
|||||||
pass
|
|
@ -1,2 +0,0 @@
|
|||||||
def get_disk_usage(*args):
|
|
||||||
return 0
|
|
@ -13,3 +13,6 @@ class QubesPropertyAccessError(BaseException):
|
|||||||
|
|
||||||
class QubesDaemonNoResponseError(BaseException):
|
class QubesDaemonNoResponseError(BaseException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class BackupCancelledError(BaseException):
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user