interpreter: wrap access to Feature value
This will allow adding "forced-off" Feature objects in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
08a8043f19
commit
5298d8eaf1
|
@ -76,25 +76,29 @@ class FeatureOptionHolder(InterpreterObject, ObjectHolder[coredata.UserFeatureOp
|
||||||
'auto': self.auto_method,
|
'auto': self.auto_method,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@property
|
||||||
|
def value(self):
|
||||||
|
return self.held_object.value
|
||||||
|
|
||||||
@noPosargs
|
@noPosargs
|
||||||
@permittedKwargs({})
|
@permittedKwargs({})
|
||||||
def enabled_method(self, args, kwargs):
|
def enabled_method(self, args, kwargs):
|
||||||
return self.held_object.is_enabled()
|
return self.value == 'enabled'
|
||||||
|
|
||||||
@noPosargs
|
@noPosargs
|
||||||
@permittedKwargs({})
|
@permittedKwargs({})
|
||||||
def disabled_method(self, args, kwargs):
|
def disabled_method(self, args, kwargs):
|
||||||
return self.held_object.is_disabled()
|
return self.value == 'disabled'
|
||||||
|
|
||||||
@noPosargs
|
@noPosargs
|
||||||
@permittedKwargs({})
|
@permittedKwargs({})
|
||||||
def allowed_method(self, args, kwargs):
|
def allowed_method(self, args, kwargs):
|
||||||
return not self.held_object.is_disabled()
|
return not self.value == 'disabled'
|
||||||
|
|
||||||
@noPosargs
|
@noPosargs
|
||||||
@permittedKwargs({})
|
@permittedKwargs({})
|
||||||
def auto_method(self, args, kwargs):
|
def auto_method(self, args, kwargs):
|
||||||
return self.held_object.is_auto()
|
return self.value == 'auto'
|
||||||
|
|
||||||
class RunProcess(InterpreterObject):
|
class RunProcess(InterpreterObject):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue