Fix travis build

This commit is contained in:
donoban 2018-10-20 23:01:35 +02:00
parent 38051ad243
commit 831769d2dd
No known key found for this signature in database
GPG Key ID: 141310D8E3ED08A5
7 changed files with 31 additions and 27 deletions

View File

@ -17,6 +17,7 @@ SOURCES = \
qubesmanager/block.py \ qubesmanager/block.py \
qubesmanager/clipboard.py \ qubesmanager/clipboard.py \
qubesmanager/create_new_vm.py \ qubesmanager/create_new_vm.py \
qubesmanager/common_threads.py \
qubesmanager/firewall.py \ qubesmanager/firewall.py \
qubesmanager/global_settings.py \ qubesmanager/global_settings.py \
qubesmanager/log_dialog.py \ qubesmanager/log_dialog.py \
@ -27,7 +28,6 @@ SOURCES = \
qubesmanager/restore.py \ qubesmanager/restore.py \
qubesmanager/settings.py \ qubesmanager/settings.py \
qubesmanager/table_widgets.py \ qubesmanager/table_widgets.py \
qubesmanager/thread_monitor.py \
qubesmanager/ui_about.py \ qubesmanager/ui_about.py \
qubesmanager/ui_backupdlg.py \ qubesmanager/ui_backupdlg.py \
qubesmanager/ui_globalsettingsdlg.py \ qubesmanager/ui_globalsettingsdlg.py \

View File

@ -44,7 +44,6 @@ import sys
import os import os
import asyncio import asyncio
from contextlib import suppress from contextlib import suppress
import time
class BackupThread(QtCore.QThread): class BackupThread(QtCore.QThread):
def __init__(self, vm): def __init__(self, vm):
@ -76,6 +75,7 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
self.backup_settings = QtCore.QSettings() self.backup_settings = QtCore.QSettings()
self.selected_vms = [] self.selected_vms = []
self.thread = None
self.setupUi(self) self.setupUi(self)

View File

@ -42,10 +42,11 @@ class CloneVMThread(QtCore.QThread):
QtCore.QThread.__init__(self) QtCore.QThread.__init__(self)
self.src_vm = src_vm self.src_vm = src_vm
self.dst_name = dst_name self.dst_name = dst_name
self.error = None
def run(self): def run(self):
try: try:
dst_vm = self.src_vm.app.clone_vm(self.src_vm, self.dst_name) self.src_vm.app.clone_vm(self.src_vm, self.dst_name)
self.error = ("Sucess", "The qube was cloned sucessfully.") self.error = ("Sucess", "The qube was cloned sucessfully.")
except exc.QubesException as ex: except exc.QubesException as ex:
self.error = ("Error while cloning Qube!", str(ex)) self.error = ("Error while cloning Qube!", str(ex))

View File

@ -22,8 +22,6 @@
# #
import sys import sys
import threading
import time
import subprocess import subprocess
from PyQt4 import QtCore, QtGui # pylint: disable=import-error from PyQt4 import QtCore, QtGui # pylint: disable=import-error
@ -78,6 +76,9 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
self.qtapp = qtapp self.qtapp = qtapp
self.app = app self.app = app
self.thread = None
self.progress = None
# Theoretically we should be locking for writing here and unlock # Theoretically we should be locking for writing here and unlock
# only after the VM creation finished. But the code would be # only after the VM creation finished. But the code would be
# more messy... # more messy...
@ -174,7 +175,7 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
if self.thread.error: if self.thread.error:
QtGui.QMessageBox.warning(None, QtGui.QMessageBox.warning(None,
self.tr("Error creating the qube!"), self.tr("Error creating the qube!"),
self.tr("ERROR: {}").format(thread.error)) self.tr("ERROR: {}").format(self.thread.error))
self.done(0) self.done(0)
@ -183,7 +184,7 @@ class NewVmDlg(QtGui.QDialog, Ui_NewVMDlg):
subprocess.check_call(['qubes-vm-settings', str(self.name)]) subprocess.check_call(['qubes-vm-settings', str(self.name)])
if self.install_system.isChecked(): if self.install_system.isChecked():
subprocess.check_call( subprocess.check_call(
['qubes-vm-boot-from-device', srt(self.name)]) ['qubes-vm-boot-from-device', str(self.name)])
def type_change(self): def type_change(self):

View File

@ -28,7 +28,6 @@ import subprocess
from datetime import datetime, timedelta from datetime import datetime, timedelta
import traceback import traceback
from contextlib import suppress from contextlib import suppress
import time
import quamash import quamash
import asyncio import asyncio
@ -282,6 +281,7 @@ class RunCommandThread(QtCore.QThread):
QtCore.QThread.__init__(self) QtCore.QThread.__init__(self)
self.vm = vm self.vm = vm
self.command_to_run = command_to_run self.command_to_run = command_to_run
self.error = None
def run(self): def run(self):
try: try:
@ -450,7 +450,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
dispatcher.add_handler('domain-start-failed', dispatcher.add_handler('domain-start-failed',
self.on_domain_status_changed) self.on_domain_status_changed)
dispatcher.add_handler('domain-stopped', self.on_domain_status_changed) dispatcher.add_handler('domain-stopped', self.on_domain_status_changed)
dispatcher.add_handler('domain-pre-shutdown', self.on_domain_status_changed) dispatcher.add_handler('domain-pre-shutdown',
self.on_domain_status_changed)
dispatcher.add_handler('domain-shutdown', self.on_domain_status_changed) dispatcher.add_handler('domain-shutdown', self.on_domain_status_changed)
dispatcher.add_handler('domain-paused', self.on_domain_status_changed) dispatcher.add_handler('domain-paused', self.on_domain_status_changed)
dispatcher.add_handler('domain-unpaused', self.on_domain_status_changed) dispatcher.add_handler('domain-unpaused', self.on_domain_status_changed)
@ -777,7 +778,8 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
# remove the VM # remove the VM
thread = common_threads.RemoveVMThread(vm) thread = common_threads.RemoveVMThread(vm)
self.threads_list.append(thread) self.threads_list.append(thread)
self.connect(thread, QtCore.SIGNAL("show_error(QString, QString)"), self.show_error) self.connect(thread, QtCore.SIGNAL("show_error(QString, QString)"),
self.show_error)
thread.finished.connect(self.clear_threads) thread.finished.connect(self.clear_threads)
thread.start() thread.start()
@ -803,7 +805,6 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow):
"Cloning Qube..."), "", 0, 0) "Cloning Qube..."), "", 0, 0)
self.progress.setCancelButton(None) self.progress.setCancelButton(None)
self.progress.setModal(True) self.progress.setModal(True)
self.thread_closes = True
self.progress.show() self.progress.show()
thread = common_threads.CloneVMThread(vm, clone_name) thread = common_threads.CloneVMThread(vm, clone_name)

View File

@ -23,8 +23,6 @@
import sys import sys
from PyQt4 import QtCore # pylint: disable=import-error from PyQt4 import QtCore # pylint: disable=import-error
from PyQt4 import QtGui # pylint: disable=import-error from PyQt4 import QtGui # pylint: disable=import-error
import threading
import time
import os import os
import os.path import os.path
import traceback import traceback
@ -39,7 +37,7 @@ from . import ui_restoredlg # pylint: disable=no-name-in-module
from . import multiselectwidget from . import multiselectwidget
from . import backup_utils from . import backup_utils
from multiprocessing import Queue, Event from multiprocessing import Queue
from multiprocessing.queues import Empty from multiprocessing.queues import Empty
from qubesadmin import Qubes, exc from qubesadmin import Qubes, exc
from qubesadmin.backup import restore from qubesadmin.backup import restore
@ -52,6 +50,7 @@ class RestoreThread(QtCore.QThread):
self.vms_to_restore = vms_to_restore self.vms_to_restore = vms_to_restore
self.error = None self.error = None
self.msg = None self.msg = None
self.canceled = None
def run(self): def run(self):
err_msg = [] err_msg = []
@ -85,6 +84,9 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
self.vms_to_restore = None self.vms_to_restore = None
self.func_output = [] self.func_output = []
self.thread = None
self.old_sigchld_handler = None
# Set up logging # Set up logging
self.feedback_queue = Queue() self.feedback_queue = Queue()
handler = logging.handlers.QueueHandler(self.feedback_queue) handler = logging.handlers.QueueHandler(self.feedback_queue)
@ -206,7 +208,8 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
and str(self.dir_line_edit.text()) and str(self.dir_line_edit.text())
.count("media/") > 0) .count("media/") > 0)
self.thread = RestoreThread(self.backup_restore, self.vms_to_restore) self.thread = RestoreThread(self.backup_restore,
self.vms_to_restore)
self.thread.finished.connect(self.thread_finished) self.thread.finished.connect(self.thread_finished)
# Start log timer # Start log timer

View File

@ -28,8 +28,6 @@ import os.path
import os import os
import re import re
import subprocess import subprocess
import threading
import time
import traceback import traceback
import sys import sys
from qubesadmin.tools import QubesArgumentParser from qubesadmin.tools import QubesArgumentParser
@ -85,9 +83,9 @@ class RenameVMThread(QtCore.QThread):
"To resolve this, please check and change the " "To resolve this, please check and change the "
"following properties and remove the qube {} " "following properties and remove the qube {} "
"manually.<br> ").format( "manually.<br> ").format(
self.vm.name, name, self.vm.name) + list_text) self.vm.name, self.vm.name, self.vm.name) + list_text)
except exc.QubesException as qex: except exc.QubesException as ex:
self.error = ("Rename error!", str(ex)) self.error = ("Rename error!", str(ex))
except Exception as ex: # pylint: disable=broad-except except Exception as ex: # pylint: disable=broad-except
self.error = ("Rename error!", repr(ex)) self.error = ("Rename error!", repr(ex))
@ -117,7 +115,7 @@ class RefreshAppsVMThread(QtCore.QThread):
if not_running: if not_running:
target_vm.shutdown() target_vm.shutdown()
except Exception as ex: except Exception as ex: # pylint: disable=broad-except
self.error = ("Refresh failed!", str(ex)) self.error = ("Refresh failed!", str(ex))
@ -265,7 +263,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
self, self,
self.tr("Error while changing settings for {0}!" self.tr("Error while changing settings for {0}!"
).format(self.vm.name), ).format(self.vm.name),
self.tr("ERROR: {0}").format('\n'.join(ret))) self.tr("ERROR: {0}").format('\n'.join(error)))
def apply(self): def apply(self):
self.save_changes() self.save_changes()