From a6c16d00be3adea4001238431349eaf5cd11019e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 26 Jun 2017 01:59:39 +0200 Subject: [PATCH] vm/qubesvm: fix handling empty kernel value Do not fail on empty kernel value - which means "use booloader on root.img". Fixes 3ddc052 "vm: move kernel presence validation to event handler" --- qubes/tests/vm/qubesvm.py | 5 +++++ qubes/vm/qubesvm.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/qubes/tests/vm/qubesvm.py b/qubes/tests/vm/qubesvm.py index 5e60dc29..cb006e34 100644 --- a/qubes/tests/vm/qubesvm.py +++ b/qubes/tests/vm/qubesvm.py @@ -360,6 +360,11 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase): self.assertPropertyInvalidValue(vm, 'kernel', 123) self.assertPropertyInvalidValue(vm, 'kernel', 'invalid') + def test_252_kernel_empty(self): + vm = self.get_vm() + self.assertPropertyValue(vm, 'kernel', '', '', '') + self.assertPropertyValue(vm, 'kernel', None, '', '') + def test_260_kernelopts(self): vm = self.get_vm() self.assertPropertyDefaultValue(vm, 'kernelopts', diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 5aca3cd4..ac5d12c2 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -755,6 +755,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): @qubes.events.handler('property-pre-set:kernel') def on_property_pre_set_kernel(self, event, name, newvalue, oldvalue=None): # pylint: disable=unused-argument + if not newvalue: + return dirname = os.path.join( qubes.config.system_path['qubes_base_dir'], qubes.config.system_path['qubes_kernels_base_dir'],