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"
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-26 01:59:39 +02:00
parent 26013122a0
commit a6c16d00be
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 7 additions and 0 deletions

View File

@ -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',

View File

@ -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'],