Fixed unexpected error on empty default template and incorrect error handling
Qubesd wrongly required default_template global property to be not None. Furthermore, even without hard failure set, require_property method raised an exception in case of a property having incorrect None value. It now logs an error message instead, as designed. fixes QubesOS/qubes-issues#5326
This commit is contained in:
parent
46ad75a3ba
commit
9d20877a43
@ -727,7 +727,10 @@ class PropertyHolder(qubes.events.Emitter):
|
||||
try:
|
||||
value = getattr(self, prop)
|
||||
if value is None and not allow_none:
|
||||
raise ValueError('Property {!r} cannot be None'.format(prop))
|
||||
msg = 'Property {!r} cannot be None'.format(prop)
|
||||
if hard:
|
||||
raise ValueError(msg)
|
||||
self.log.fatal(msg)
|
||||
except AttributeError:
|
||||
# pylint: disable=no-member
|
||||
msg = 'Required property {!r} not set on {!r}'.format(prop, self)
|
||||
|
@ -937,7 +937,7 @@ class Qubes(qubes.PropertyHolder):
|
||||
# stage 5: misc fixups
|
||||
|
||||
self.property_require('default_netvm', allow_none=True)
|
||||
self.property_require('default_template')
|
||||
self.property_require('default_template', allow_none=True)
|
||||
self.property_require('clockvm', allow_none=True)
|
||||
self.property_require('updatevm', allow_none=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user