Fix get_coe_valodator() clear unused Validator
1.The first 'if' of get_coe_valodator() is useless, becuase cls.validators usually is {}. 2.When getting kubernetes coe, SwarmValidator() and MesosValidator() should not be called. Change-Id: Ic90b3004b646c01de226f07e281b3250fe9ba911
This commit is contained in:
parent
835169aaed
commit
820603bbc6
|
@ -168,18 +168,14 @@ def validate_bay_properties(delta):
|
|||
|
||||
class Validator(object):
|
||||
|
||||
validators = {}
|
||||
|
||||
@classmethod
|
||||
def get_coe_validator(cls, coe):
|
||||
if not cls.validators:
|
||||
cls.validators = {
|
||||
'kubernetes': K8sValidator(),
|
||||
'swarm': SwarmValidator(),
|
||||
'mesos': MesosValidator(),
|
||||
}
|
||||
if coe in cls.validators:
|
||||
return cls.validators[coe]
|
||||
if coe == 'kubernetes':
|
||||
return K8sValidator()
|
||||
elif coe == 'swarm':
|
||||
return SwarmValidator()
|
||||
elif coe == 'mesos':
|
||||
return MesosValidator()
|
||||
else:
|
||||
raise exception.InvalidParameterValue(
|
||||
_('Requested COE type %s is not supported.') % coe)
|
||||
|
|
Loading…
Reference in New Issue