[Freeipa-devel] [PATCH] 0007 Add command to test HBAC rules

Alexander Bokovoy abokovoy at redhat.com
Fri Jul 29 03:38:11 UTC 2011


On 28.07.2011 23:42, Rob Crittenden wrote:
>> Fixed this now and also removed some residual debug prints in unit
>> tests. Patch attached.
>>
> 
> nack
> 
> There is an EXAMPLES section in the help but it just explains the
> options and provides no examples. I think we can just drop the EXAMPLES
> header. Providing examples for this might be rather convoluted, though
> seeing a couple of command-lines might provide enough context.
I decided to add examples.

> It should probably mention that user, srchost, host and service are all
> required but that becomes rather obvious when you try to execute the
> command.
Added this.

> If you provide a single, not found rule to test against a ValueError is
> thrown when validating that the output is valid.
> 
> $ ipa hbactest --user=rcrit --srchost=foo --host=bar --service=baz
> --rules=testnotfound
> 
> ipa: ERROR: non-public: ValueError: hbactest.validate_output(): missing
> keys ['matched', 'notmatched'] in {'error': [u'test22'], 'value':
> u'False', 'summary': u'Unresolved rules in --rules'}
> Traceback (most recent call last):
>   File "/home/rcrit/redhat/freeipa-master/ipaserver/rpcserver.py", line
> 220, in wsgi_execute
>     result = self.Command[name](*args, **options)
>   File "/home/rcrit/redhat/freeipa-master/ipalib/frontend.py", line 436,
> in __call__
>     self.validate_output(ret)
>   File "/home/rcrit/redhat/freeipa-master/ipalib/frontend.py", line 883,
> in validate_output
>     nice, missing, output)
> ValueError: hbactest.validate_output(): missing keys ['matched',
> 'notmatched'] in {'error': [u'test22'], 'value': u'False', 'summary':
> u'Unresolved rules in --rules'}
> ipa: DEBUG: response: InternalError: an internal error has occurred
> 
My bad (two returns taking different paths).

Fixed that all and added unit test for non-existing rules.
Modified description to be more detailed and added real examples.

-- 
/ Alexander Bokovoy
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: freeipa-abbra-0007-5-add-hbactest-command.patch
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20110729/78e8add3/attachment.ksh>


More information about the Freeipa-devel mailing list