refactor 'QUBESD_SOCKET' into separate module
This will avoid cyclic imports in upcoming events implementation
This commit is contained in:
parent
36d8ee9b32
commit
d8b0ff349d
@ -21,12 +21,14 @@
|
|||||||
'''Qubes OS management client.'''
|
'''Qubes OS management client.'''
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
import qubesmgmt.config
|
||||||
import qubesmgmt.base
|
import qubesmgmt.base
|
||||||
import qubesmgmt.app
|
import qubesmgmt.app
|
||||||
|
|
||||||
DEFAULT = qubesmgmt.base.DEFAULT
|
DEFAULT = qubesmgmt.base.DEFAULT
|
||||||
|
|
||||||
if os.path.exists(qubesmgmt.app.QUBESD_SOCK):
|
if os.path.exists(qubesmgmt.config.QUBESD_SOCKET):
|
||||||
Qubes = qubesmgmt.app.QubesLocal
|
Qubes = qubesmgmt.app.QubesLocal
|
||||||
else:
|
else:
|
||||||
Qubes = qubesmgmt.app.QubesRemote
|
Qubes = qubesmgmt.app.QubesRemote
|
||||||
|
@ -27,13 +27,13 @@ import socket
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import qubesmgmt.base
|
import qubesmgmt.base
|
||||||
import qubesmgmt.vm
|
|
||||||
import qubesmgmt.label
|
|
||||||
import qubesmgmt.exc
|
import qubesmgmt.exc
|
||||||
import qubesmgmt.utils
|
import qubesmgmt.label
|
||||||
import qubesmgmt.storage
|
import qubesmgmt.storage
|
||||||
|
import qubesmgmt.utils
|
||||||
|
import qubesmgmt.vm
|
||||||
|
import qubesmgmt.config
|
||||||
|
|
||||||
QUBESD_SOCK = '/var/run/qubesd.sock'
|
|
||||||
BUF_SIZE = 4096
|
BUF_SIZE = 4096
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +103,6 @@ class VMCollection(object):
|
|||||||
return self._vm_list.keys()
|
return self._vm_list.keys()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QubesBase(qubesmgmt.base.PropertyHolder):
|
class QubesBase(qubesmgmt.base.PropertyHolder):
|
||||||
'''Main Qubes application'''
|
'''Main Qubes application'''
|
||||||
|
|
||||||
@ -182,7 +181,7 @@ class QubesLocal(QubesBase):
|
|||||||
def qubesd_call(self, dest, method, arg=None, payload=None):
|
def qubesd_call(self, dest, method, arg=None, payload=None):
|
||||||
try:
|
try:
|
||||||
client_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
client_socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
client_socket.connect(QUBESD_SOCK)
|
client_socket.connect(qubesmgmt.config.QUBESD_SOCKET)
|
||||||
except IOError:
|
except IOError:
|
||||||
# TODO:
|
# TODO:
|
||||||
raise
|
raise
|
||||||
|
24
qubesmgmt/config.py
Normal file
24
qubesmgmt/config.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*- encoding: utf8 -*-
|
||||||
|
#
|
||||||
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
|
#
|
||||||
|
# Copyright (C) 2017 Marek Marczykowski-Górecki
|
||||||
|
# <marmarek@invisiblethingslab.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
'''Configuration variables/constants'''
|
||||||
|
|
||||||
|
#: path to qubesd socket
|
||||||
|
QUBESD_SOCKET = '/var/run/qubesd.sock'
|
Loading…
Reference in New Issue
Block a user