There is no need to check if the input is None or not.

Found on Master branch.

For the function "validate" in senlin/policies/scaling_policy.py,
the check to make sure self.adjustment_min_step,
self.cooldown and self.adjustment_number is validate is not needed.

The validattion for their type is already constrained by schema type.

Change-Id: I3c7fa5978ff768540abf70d25cfee6bad5da736f
Closes-Bug: #1675630
This commit is contained in:
Jeffrey Guan 2017-03-24 01:00:38 -04:00
parent 630f5539ef
commit b39f22f35d
1 changed files with 3 additions and 4 deletions

View File

@ -138,16 +138,15 @@ class ScalingPolicy(base.Policy):
def validate(self, context, validate_props=False):
super(ScalingPolicy, self).validate(context, validate_props)
if self.adjustment_number is not None and self.adjustment_number <= 0:
if self.adjustment_number <= 0:
msg = _("the 'number' for 'adjustment' must be > 0")
raise exc.InvalidSpec(message=msg)
if (self.adjustment_min_step is not None and
self.adjustment_min_step < 0):
if self.adjustment_min_step < 0:
msg = _("the 'min_step' for 'adjustment' must be >= 0")
raise exc.InvalidSpec(message=msg)
if self.cooldown is not None and self.cooldown < 0:
if self.cooldown < 0:
msg = _("the 'cooldown' for 'adjustment' must be >= 0")
raise exc.InvalidSpec(message=msg)