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

Rob Crittenden rcritten at redhat.com
Wed Jul 27 19:02:55 UTC 2011


Martin Kosek wrote:
> On Wed, 2011-07-27 at 10:26 -0400, Rob Crittenden wrote:
>> Rob Crittenden wrote:
>>> 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
>>
>> Updated patch attached.
>>
>> rob
>
> ACK.
>
> It could be useful to check that automountmap created by faulty
> automountmap_add_indirect is really not created. But since you are
> already working on rewriting automount unit tests it would be OK to add
> it there.
>
> Martin
>

pushed to master and ipa-2-0




More information about the Freeipa-devel mailing list