config: eliminate duplicated qubes_base_dir

Remove it from system_path dict, have it in one place.
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-01 23:25:47 +02:00
parent 317d140f46
commit 075d991114
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
5 changed files with 9 additions and 11 deletions

View File

@ -724,7 +724,7 @@ class Qubes(qubes.PropertyHolder):
else:
self._store = os.environ.get('QUBES_XML_PATH',
os.path.join(
qubes.config.system_path['qubes_base_dir'],
qubes.config.qubes_base_dir,
qubes.config.system_path['qubes_store_filename']))
super(Qubes, self).__init__(xml=None, **kwargs)

View File

@ -36,8 +36,6 @@ system_path = {
'qrexec_client_path': '/usr/lib/qubes/qrexec-client',
'qubesdb_daemon_path': '/usr/sbin/qubesdb-daemon',
'qubes_base_dir': qubes_base_dir,
# Relative to qubes_base_dir
'qubes_appvms_dir': 'appvms',
'qubes_templates_dir': 'vm-templates',

View File

@ -583,7 +583,7 @@ class SystemTestsMixin(object):
# need some information from the real qubes.xml - at least installed
# templates; should not be used for testing, only to initialize self.app
self.host_app = qubes.Qubes(os.path.join(
qubes.config.system_path['qubes_base_dir'],
qubes.config.qubes_base_dir,
qubes.config.system_path['qubes_store_filename']))
if os.path.exists(CLASS_XMLPATH):
shutil.copy(CLASS_XMLPATH, XMLPATH)
@ -727,7 +727,7 @@ class SystemTestsMixin(object):
'qubes_appvms_dir',
'qubes_servicevms_dir',
'qubes_templates_dir'):
dirpath = os.path.join(qubes.config.system_path['qubes_base_dir'],
dirpath = os.path.join(qubes.config.qubes_base_dir,
qubes.config.system_path[dirspec], vmname)
if os.path.exists(dirpath):
if os.path.isdir(dirpath):
@ -791,7 +791,7 @@ class SystemTestsMixin(object):
'qubes_appvms_dir',
'qubes_servicevms_dir',
'qubes_templates_dir'):
dirpath = os.path.join(qubes.config.system_path['qubes_base_dir'],
dirpath = os.path.join(qubes.config.qubes_base_dir,
qubes.config.system_path[dirspec])
for name in os.listdir(dirpath):
if name.startswith(prefix):

View File

@ -306,8 +306,8 @@ class TC_03_FilePool(qubes.tests.QubesTestCase):
def setUp(self):
""" Add a test file based storage pool """
super(TC_03_FilePool, self).setUp()
self._orig_qubes_base_dir = qubes.config.system_path['qubes_base_dir']
qubes.config.system_path['qubes_base_dir'] = '/tmp/qubes-test'
self._orig_qubes_base_dir = qubes.config.qubes_base_dir
qubes.config.qubes_base_dir = '/tmp/qubes-test'
self.app = TestApp()
self.app.create_dummy_template()
self.app.add_pool(**self.POOL_CONFIG)
@ -320,7 +320,7 @@ class TC_03_FilePool(qubes.tests.QubesTestCase):
shutil.rmtree(self.POOL_DIR, ignore_errors=True)
if os.path.exists('/tmp/qubes-test'):
shutil.rmtree('/tmp/qubes-test')
qubes.config.system_path['qubes_base_dir'] = self._orig_qubes_base_dir
qubes.config.qubes_base_dir = self._orig_qubes_base_dir
def test_001_pool_exists(self):
""" Check if the storage pool was added to the storage pool config """

View File

@ -577,7 +577,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
def dir_path(self):
'''Root directory for files related to this domain'''
return os.path.join(
qubes.config.system_path['qubes_base_dir'],
qubes.config.qubes_base_dir,
self.dir_path_prefix,
self.name)
@ -716,7 +716,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
if not newvalue:
return
dirname = os.path.join(
qubes.config.system_path['qubes_base_dir'],
qubes.config.qubes_base_dir,
qubes.config.system_path['qubes_kernels_base_dir'],
newvalue)
if not os.path.exists(dirname):