raise ValidationError when deprecated param is passed to command

https://fedorahosted.org/freeipa/ticket/6190

Reviewed-By: Lenka Doudova <ldoudova@redhat.com>
This commit is contained in:
Martin Babinsky 2016-07-19 17:05:32 +02:00
parent 4ca671788c
commit 82e754e9c5

View File

@ -854,6 +854,9 @@ class Param(ReadOnly):
if self.required or (supplied and 'nonempty' in self.flags):
raise RequirementError(name=self.name)
return
if self.deprecated:
raise ValidationError(name=self.get_param_name(),
error=_('this option is deprecated'))
if self.multivalue:
if type(value) is not tuple:
raise TypeError(
@ -876,10 +879,6 @@ class Param(ReadOnly):
if error is not None:
raise ValidationError(name=self.get_param_name(), error=error)
def _rule_deprecated(self, _, value):
if self.deprecated:
return _('this option is deprecated')
def get_default(self, **kw):
"""
Return the static default or construct and return a dynamic default.