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:
Marek Marczykowski-Górecki 2019-10-24 04:52:04 +02:00
parent 563f4d0aec
commit 7bdcb23fb8
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
6 changed files with 6 additions and 13 deletions

View File

@ -23,7 +23,6 @@
import signal
from qubesadmin import exc
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 . import ui_backupdlg # pylint: disable=no-name-in-module
@ -35,6 +34,7 @@ from . import utils
import grp
import pwd
import os
import shutil
# pylint: disable=too-few-public-methods
@ -202,7 +202,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, QtWidgets.QWizard):
if vm.qid == 0:
local_user = grp.getgrnam('qubes').gr_mem[0]
home_dir = pwd.getpwnam(local_user).pw_dir
self.size = get_disk_usage(home_dir)
self.size = shutil.disk_usage(home_dir)[1]
else:
self.size = vm.get_disk_utilization()
super(BackupVMsWindow.VmListItem, self).__init__(

View File

@ -26,8 +26,6 @@ import os.path
import logging
import logging.handlers
from qubes import backup
from . import ui_restoredlg # pylint: disable=no-name-in-module
from . import multiselectwidget
from . import backup_utils
@ -53,7 +51,7 @@ class RestoreThread(QtCore.QThread):
try:
self.backup_restore.restore_do(self.vms_to_restore)
except backup.BackupCanceledError as ex:
except exc.BackupCancelledError as ex:
self.canceled = True
err_msg.append(str(ex))
except Exception as ex: # pylint: disable=broad-except

View File

@ -1,5 +0,0 @@
class BackupCanceledError(BaseException):
tmpdir = None
pass

View File

@ -1 +0,0 @@
pass

View File

@ -1,2 +0,0 @@
def get_disk_usage(*args):
return 0

View File

@ -13,3 +13,6 @@ class QubesPropertyAccessError(BaseException):
class QubesDaemonNoResponseError(BaseException):
pass
class BackupCancelledError(BaseException):
pass