[Freeipa-devel] [PATCH] 0032 Fix error message for nonexistent members and add tests.

David Kupka dkupka at redhat.com
Mon Nov 24 12:20:47 UTC 2014


On 11/21/2014 04:23 PM, Tomas Babej wrote:
>
> On 11/21/2014 04:11 PM, David Kupka wrote:
>> https://fedorahosted.org/freeipa/ticket/4643
>>
>>
>> _______________________________________________
>> Freeipa-devel mailing list
>> Freeipa-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/freeipa-devel
>
> -                obj.get_dn_if_exists(name)
> +                try:
> +                    obj.get_dn(name)
> +                except errors.NotFound:
> +                    obj.handle_not_found(*keys)
>
> You switched from get_dn_if_exists to get_dn, why? The get_dn method
> never raises the NotFound error, it just constructs the dn regardless of
> the fact whether the actual entry at that dn exists.
>
> You need to use get_dn_if_exists here. Some negative tests for this
> would be welcome :).
>
> Indeed, by testing the patch:
>
> [tbabej at vm-218 ~]$ ipa automember_rebuild --users=doesnotexist
> --------------------------------------------------------
> Automember rebuild task finished. Processed (0) entries.
> --------------------------------------------------------
>
> Where the old behaviour was:
>
> [tbabej at vm-218 ~]$ ipa automember_rebuild --users=test
> ipa: ERROR: no such entry
>
Thanks for catching this Friday-afternoon brain error.
Attached patch should work as expected.

-- 
David Kupka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-dkupka-0032-2-Fix-error-message-for-nonexistent-members-and-add-te.patch
Type: text/x-patch
Size: 3461 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20141124/693133aa/attachment.bin>


More information about the Freeipa-devel mailing list