[Freeipa-devel] [PATCH] 55 Parse comma-separated lists of values in all parameter types

Jan Cholasta jcholast at redhat.com
Mon Oct 24 16:45:20 UTC 2011


Dne 24.10.2011 17:42, Rob Crittenden napsal(a):
> Jan Cholasta wrote:
>> Dne 20.10.2011 13:20, Jan Cholasta napsal(a):
>>> Parse comma-separated lists of values in all parameter types. This can
>>> enabled for a specific parameter by setting the "csvlist" option to
>>> True.
>>>
>>> Remove List parameter type and replace all occurences with Str with
>>> csvlist enabled.
>>>
>>> https://fedorahosted.org/freeipa/ticket/2007
>>>
>>> This change will be useful for
>>> https://fedorahosted.org/freeipa/ticket/1487 and
>>> https://fedorahosted.org/freeipa/ticket/1847
>>>
>>> Unit tests show no regressions.
>>>
>>> Honza
>>>
>>
>> Self-NACK - I have noticed that the batch command no longer works.
>>
>> Updated patch attached.
>>
>> Honza
>
> What is the benefit of this over the List parameter type?
>
> rob

Mainly because the List parameter type is just a hack. This is the right 
thing to do if we want to use comma-separated lists of parameters of any 
type, with all the validation and other parameter type-specific features.

For example, I've added a new parameter type for IP addresses in my 
patch 46 
(http://www.redhat.com/archives/freeipa-devel/2011-September/msg00187.html) 
and use it for A and AAAA DNS records. Without this patch, we can either 
use List for the record parameters and lose validation in dnsrecord-find 
(because it is based on crud.Search, which strips all the custom 
validation rules - like _validate_ipaddr - from the command parameters, 
which is one of the causes of #1627) or use IPAddress for the record 
parameters and lose the ability to specify them as comma-separated list 
of values. With this patch, we can have both comma-separated lists and 
validation at the same time.

Besides, the patch is not as big as it looks like, all the interesting 
stuff is in ipalib/parameters.py, everything else is just 
search-and-replace. Also I need it to fix #1487 and #1847 without doing 
ugly hacks.

Honza

-- 
Jan Cholasta




More information about the Freeipa-devel mailing list