[Freeipa-devel] [PATCH] 839 check for duplicate keys when adding indirect maps

Rob Crittenden rcritten at redhat.com
Mon Jul 25 15:08:14 UTC 2011


Martin Kosek wrote:
> On Mon, 2011-07-25 at 10:08 -0400, Rob Crittenden wrote:
>> When adding an indirect map verify that the key doesn't already exist.
>>
>> There is still the chance of collision but checking first should limit
>> it in any case.
>>
>> https://fedorahosted.org/freeipa/ticket/1520
>>
>> rob
>
> This patch is OK functionally, but it can be improved. This command
> consists of 2 sub-commands. Checking for one sub-command's corner-case
> (by automountkey_show) may be OK for now, but it doesn't cover a
> situation when second sub-command fails for some other error.
>
> I think this is what we should to do:
>
> try:
> 	automountmap_add
> 	automountkey_add
> except Exception, e:
> 	Clean up - remove possibly created automountmap
> 	raise e
>
> That way we will be covered for more corner-cases + we will save one
> automountkey_show and speed up the command.
>
> Martin
>

Except in the case where a user is delegated to only be able to add 
maps/keys and not remove them.

Still, this method is easier to understand, I'll consider it.

rob




More information about the Freeipa-devel mailing list