there is no need to check if the input is None or not.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
senlin |
Fix Released
|
Undecided
|
Jeffrey Guan |
Bug Description
Found on Master branch.
Description:
For the function validate in senlin/
self.adjustmen
def validate(self, context, validate_
if self.adjustment
msg = _("the 'number' for 'adjustment' must be > 0")
raise exc.InvalidSpec
if (self.adjustmen
msg = _("the 'min_step' for 'adjustment' must be >= 0")
raise exc.InvalidSpec
if self.cooldown is not None and self.cooldown < 0:
msg = _("the 'cooldown' for 'adjustment' must be >= 0")
raise exc.InvalidSpec
Analysis:
Take self.adjustment
there is a function to_schema_type():
278 def to_schema_
279 if isinstance(value, numbers.Number):
280 return value
281
282 try:
283 return int(value)
284 except ValueError:
285 try:
286 return float(value)
287 except ValueError:
288 msg = _("The value '%s' is not a valid number.") % value
289 raise exc.ESchema(
and a check already here, in my opinion, there is no need to do extra check-none in the function "validate".
Changed in senlin: | |
assignee: | nobody → Jeffrey Guan (double12gzh) |
status: | New → In Progress |
Fix proposed to branch: master /review. openstack. org/449430
Review: https:/