Turns out with the current implementation of the type system a variable can both be required and not required. Interesting (but perhaps worth a further look).
Signed-off-by: Guido Trotter <[email protected]> --- lib/cmdlib.py | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index d4a6c55..51e3941 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -9668,15 +9668,13 @@ class LUTestDelay(NoHooksLU): ("duration", _TFloat), ("on_master", _TBool), ("on_nodes", _TListOf(_TNonEmptyString)), + ("repeat", _TPositiveInt) + ] + _OP_DEFS = [ + ("repeat", 0), ] REQ_BGL = False - def CheckArguments(self): - # TODO: convert to the type system - self.op.repeat = getattr(self.op, "repeat", 0) - if self.op.repeat < 0: - raise errors.OpPrereqError("Repetition count cannot be negative") - def ExpandNames(self): """Expand names and set required locks. -- 1.7.1
