qubes/app: split initialising empty Qubes object from saving it

It may be useful to create fresh Qubes() object but not save it yet
before setting other things. One such case is migration from core2.
This commit is contained in:
Marek Marczykowski-Górecki 2016-05-21 03:32:13 +02:00 committed by Wojtek Porczyk
parent 2909d252d6
commit 692f75353e

View File

@ -772,10 +772,7 @@ class Qubes(qubes.PropertyHolder):
self.__load_timestamp = os.path.getmtime(self._store)
os.close(fd_old)
@classmethod
def create_empty_store(cls, *args, **kwargs):
self = cls(*args, load=False, **kwargs)
def load_initial_values(self):
self.labels = {
1: qubes.Label(1, '0xcc0000', 'red'),
2: qubes.Label(2, '0xf57900', 'orange'),
@ -792,6 +789,11 @@ class Qubes(qubes.PropertyHolder):
self.domains.add(
qubes.vm.adminvm.AdminVM(self, None, qid=0, name='dom0'))
@classmethod
def create_empty_store(cls, *args, **kwargs):
self = cls(*args, load=False, **kwargs)
self.load_initial_values()
self.save()
return self