Applied corrections from @marmarek
This commit is contained in:
parent
135060dfe7
commit
5f1e4803fe
@ -4,7 +4,6 @@ language: python
|
||||
python:
|
||||
- '3.5'
|
||||
install:
|
||||
- sudo apt-get install python-qt4 pyqt4-dev-tools
|
||||
- pip install --quiet -r ci/requirements.txt
|
||||
- git clone https://github.com/QubesOS/qubes-builder ~/qubes-builder
|
||||
script:
|
||||
|
@ -20,10 +20,9 @@
|
||||
import sys
|
||||
import subprocess
|
||||
from . import utils
|
||||
from . import firewall
|
||||
from . import ui_bootfromdevice # pylint: disable=no-name-in-module
|
||||
from PyQt4 import QtGui, QtCore # pylint: disable=import-error
|
||||
import qubesadmin.tools.qvm_start as qvm_start
|
||||
from qubesadmin import tools
|
||||
|
||||
|
||||
class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
@ -63,7 +62,7 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
self.tr("ERROR!"),
|
||||
self.tr("No file or block device selected; please select one."))
|
||||
return
|
||||
qvm_start.main(['--cdrom', cdrom_location, self.vm.name])
|
||||
tools.qvm_start.main(['--cdrom', cdrom_location, self.vm.name])
|
||||
|
||||
def __init_buttons__(self):
|
||||
self.fileVM.setEnabled(False)
|
||||
@ -111,7 +110,7 @@ class VMBootFromDeviceWindow(ui_bootfromdevice.Ui_BootDialog, QtGui.QDialog):
|
||||
self.pathText.setText(new_path)
|
||||
|
||||
|
||||
parser = firewall.qubesadmin.tools.QubesArgumentParser(vmname_nargs=1)
|
||||
parser = tools.QubesArgumentParser(vmname_nargs=1)
|
||||
|
||||
def main(args=None):
|
||||
args = parser.parse_args(args)
|
||||
|
@ -148,14 +148,13 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
r"(?P<name>[a-z][a-z0-9-]+)\s+(?P<port>[0-9]+)/"
|
||||
r"(?P<protocol>[a-z]+)",
|
||||
re.IGNORECASE)
|
||||
file = open('/etc/services', 'r')
|
||||
for line in file:
|
||||
match = pattern.match(line)
|
||||
if match is not None:
|
||||
service = match.groupdict()
|
||||
self.__services.append(
|
||||
(service["name"], int(service["port"]),))
|
||||
file.close()
|
||||
with open('/etc/services', 'r') as file:
|
||||
for line in file:
|
||||
match = pattern.match(line)
|
||||
if match is not None:
|
||||
service = match.groupdict()
|
||||
self.__services.append(
|
||||
(service["name"], int(service["port"]),))
|
||||
|
||||
self.fw_changed = False
|
||||
self.allow = None # is the default policy allow or deny
|
||||
@ -165,8 +164,8 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
|
||||
def sort(self, idx, order):
|
||||
rev = (order == QtCore.Qt.AscendingOrder)
|
||||
self.children.sort(key=lambda x: self.get_column_string(idx, x)
|
||||
, reverse=rev)
|
||||
self.children.sort(key=lambda x: self.get_column_string(idx, x),
|
||||
reverse=rev)
|
||||
|
||||
index1 = self.createIndex(0, 0)
|
||||
index2 = self.createIndex(len(self) - 1, len(self.__column_names) - 1)
|
||||
@ -388,7 +387,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
self.tr("Invalid port or service"),
|
||||
self.tr("Port number or service '{0}' is invalid.")
|
||||
.format(service))
|
||||
elif service is not None and service != "":
|
||||
elif service:
|
||||
try:
|
||||
rule.dstports = service
|
||||
except (TypeError, ValueError):
|
||||
@ -425,9 +424,7 @@ class QubesFirewallRulesModel(QtCore.QAbstractItemModel):
|
||||
# pylint: disable=invalid-name,no-self-use
|
||||
def hasChildren(self, index=QtCore.QModelIndex()):
|
||||
parent_item = index.internalPointer()
|
||||
if parent_item is not None:
|
||||
return False
|
||||
return True
|
||||
return parent_item is None
|
||||
|
||||
def data(self, index, role=QtCore.Qt.DisplayRole):
|
||||
if index.isValid() and role == QtCore.Qt.DisplayRole:
|
||||
|
@ -158,7 +158,7 @@ class GlobalSettingsWindow(ui_globalsettingsdlg.Ui_GlobalSettings,
|
||||
def __init_kernel_defaults__(self):
|
||||
kernel_list = []
|
||||
# TODO system_path["qubes_kernels_base_dir"]
|
||||
# idea: qubes.pulls['linux-kernel'].volumes
|
||||
# idea: qubes.pools['linux-kernel'].volumes
|
||||
for k in os.listdir('/var/lib/qubes/vm-kernels'):
|
||||
kernel_list.append(k)
|
||||
|
||||
|
@ -31,6 +31,7 @@ import traceback
|
||||
import os
|
||||
import sys
|
||||
from qubesadmin.tools import QubesArgumentParser
|
||||
from qubesadmin import devices
|
||||
import qubesadmin.exc
|
||||
|
||||
from . import utils
|
||||
@ -665,7 +666,7 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
||||
for i in range(self.dev_list.selected_list.count())]
|
||||
for ident in new:
|
||||
if ident not in old:
|
||||
ass = firewall.qubesadmin.devices.DeviceAssignment(
|
||||
ass = devices.DeviceAssignment(
|
||||
self.vm.app.domains['dom0'],
|
||||
ident.replace(':', '_'),
|
||||
persistent=True)
|
||||
|
@ -1 +0,0 @@
|
||||
### mock qubesadmin.DEFAULT module
|
@ -1,2 +1,4 @@
|
||||
class Qubes(object):
|
||||
pass
|
||||
pass
|
||||
|
||||
DEFAULT = object()
|
||||
|
@ -1,4 +1,4 @@
|
||||
### mock qubesadmin.devices module
|
||||
|
||||
class DeviceAssignment(object):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
### mock qubesadmin.exc module
|
||||
|
||||
class QubesException(BaseException):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
### mock qubesadmin.firewall module
|
||||
|
||||
class Rule(object):
|
||||
pass
|
||||
pass
|
||||
|
@ -1,4 +1,4 @@
|
||||
### mock qvm_start module
|
||||
|
||||
def main(*args, **kwargs):
|
||||
pass
|
||||
pass
|
||||
|
@ -4,4 +4,4 @@ def parse_size(*args, **kwargs):
|
||||
return args[0]
|
||||
|
||||
def updates_vms_status(*args, **kwargs):
|
||||
return args[0]
|
||||
return args[0]
|
||||
|
Loading…
Reference in New Issue
Block a user