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:
parent
2909d252d6
commit
692f75353e
10
qubes/app.py
10
qubes/app.py
@ -772,10 +772,7 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
self.__load_timestamp = os.path.getmtime(self._store)
|
self.__load_timestamp = os.path.getmtime(self._store)
|
||||||
os.close(fd_old)
|
os.close(fd_old)
|
||||||
|
|
||||||
|
def load_initial_values(self):
|
||||||
@classmethod
|
|
||||||
def create_empty_store(cls, *args, **kwargs):
|
|
||||||
self = cls(*args, load=False, **kwargs)
|
|
||||||
self.labels = {
|
self.labels = {
|
||||||
1: qubes.Label(1, '0xcc0000', 'red'),
|
1: qubes.Label(1, '0xcc0000', 'red'),
|
||||||
2: qubes.Label(2, '0xf57900', 'orange'),
|
2: qubes.Label(2, '0xf57900', 'orange'),
|
||||||
@ -792,6 +789,11 @@ class Qubes(qubes.PropertyHolder):
|
|||||||
|
|
||||||
self.domains.add(
|
self.domains.add(
|
||||||
qubes.vm.adminvm.AdminVM(self, None, qid=0, name='dom0'))
|
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()
|
self.save()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
Loading…
Reference in New Issue
Block a user