From 692f75353efb571ce84c19bb7d28ed293108b28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 21 May 2016 03:32:13 +0200 Subject: [PATCH] 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. --- qubes/app.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qubes/app.py b/qubes/app.py index 0c55429f..e7b06a77 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -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