[Freeipa-devel] [PATCH] 0006 Raise ACI error when CSR has no subject hostname

Martin Kosek mkosek at redhat.com
Tue Dec 11 08:27:48 UTC 2012


On 12/11/2012 09:24 AM, Lynn Root wrote:
> 
>> The following raises ACIError because of failed authorization check, I think
>> its ok.
>>
>> RequirementError is only thrown when a command option that is required is not
>> passed by the user. I am not fond of expanding its use to the validation of
>> user content, like CSR file.
>>
>> NotFound error is used when an _entry_ is not found - so not an ideal candidate
>> either for this case.
>>
>> IMHO, ValidationError is fine for this situation - but maybe somebody else may
>> have other opinion...
>>
>> Martin
> I assume no one is up in arms about electing to go for ValidationError :)
> 
> New patch attached.  Thanks for your help, Martin!
> 

This is better. Though this raise statement would raise a different exception
that one would expect...

>>> from ipalib import errors, _
>>> raise errors.ValidationError(info=_("No hostname was found in subject of
request"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ipalib/errors.py", line 268, in __init__
    self.msg = self.format % kw
KeyError: 'name'

Martin




More information about the Freeipa-devel mailing list