diff --git a/qubesmgmt/__init__.py b/qubesmgmt/__init__.py index 2ecfcf6..d7d438f 100644 --- a/qubesmgmt/__init__.py +++ b/qubesmgmt/__init__.py @@ -21,12 +21,14 @@ '''Qubes OS management client.''' import os + +import qubesmgmt.config import qubesmgmt.base import qubesmgmt.app DEFAULT = qubesmgmt.base.DEFAULT -if os.path.exists(qubesmgmt.app.QUBESD_SOCK): +if os.path.exists(qubesmgmt.config.QUBESD_SOCKET): Qubes = qubesmgmt.app.QubesLocal else: Qubes = qubesmgmt.app.QubesRemote diff --git a/qubesmgmt/app.py b/qubesmgmt/app.py index c8fe3b9..486a77e 100644 --- a/qubesmgmt/app.py +++ b/qubesmgmt/app.py @@ -27,13 +27,13 @@ import socket import subprocess import qubesmgmt.base -import qubesmgmt.vm -import qubesmgmt.label import qubesmgmt.exc -import qubesmgmt.utils +import qubesmgmt.label import qubesmgmt.storage +import qubesmgmt.utils +import qubesmgmt.vm +import qubesmgmt.config -QUBESD_SOCK = '/var/run/qubesd.sock' BUF_SIZE = 4096 @@ -103,7 +103,6 @@ class VMCollection(object): return self._vm_list.keys() - class QubesBase(qubesmgmt.base.PropertyHolder): '''Main Qubes application''' @@ -182,7 +181,7 @@ class QubesLocal(QubesBase): def qubesd_call(self, dest, method, arg=None, payload=None): try: client_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - client_socket.connect(QUBESD_SOCK) + client_socket.connect(qubesmgmt.config.QUBESD_SOCKET) except IOError: # TODO: raise diff --git a/qubesmgmt/config.py b/qubesmgmt/config.py new file mode 100644 index 0000000..83c3d2d --- /dev/null +++ b/qubesmgmt/config.py @@ -0,0 +1,24 @@ +# -*- encoding: utf8 -*- +# +# The Qubes OS Project, http://www.qubes-os.org +# +# Copyright (C) 2017 Marek Marczykowski-Górecki +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with this program; if not, see . + +'''Configuration variables/constants''' + +#: path to qubesd socket +QUBESD_SOCKET = '/var/run/qubesd.sock'