[Freeipa-devel] Re: [PATCH] Add conversion of attribute name synonyms when generating modlists.

Rob Crittenden rcritten at redhat.com
Fri Jun 12 15:49:57 UTC 2009


Pavel Zůna wrote:
> Rob Crittenden wrote:
>> Pavel Zuna wrote:
>>> Patch 0003: Add conversion of attribute name synonyms when generating 
>>> modlists.
>>>
>>> Fixes the bug with 'localityname' in host plugins and prevents 
>>> similar bugs from happening.
>>>
>>> Pavel
>>
>> I'm not sure I understand this patch. What is the purpose of 
>> preferred_names? It looks that if this is set the the translation 
>> doesn't actually happen (and this is always set).
>>
>> rob
> 
> If preferred_names evaluate to True (if not None and not and empty 
> list), then all attribute names equivalent to those in preferred names 
> are converted to them. Otherwise all attributes are converted to their 
> preferred synonym according to the schema.
> 
> For example:
> 
> a = {'locality': 'Brno'}
> ldap.convert_attr_synonyms(a, ['localityname'])
> # a == {'localityname': 'Brno'}
> ldap.convert_attr_synonyms(a)
> # a == {'l': 'Brno'}
> 
> I did it this way, so when generating a modlist, we can convert 
> attributes as returned by python-ldap to what the plugin uses.
> 
> Pavel
> 

Ok, this is where I got confused. You don't actually make that second 
call (without the preferred_names) anywhere in the patch.

I'm not sure we need to do the preferred name though, we'll still end up 
with extra MOD operations this way. Take an example:

I add a host:

% ipa host-add --locality=Brno h1.example.com

When the record is added 389 is going to change the attribute to 'l'.

   dn: fqdn=h1.example.com,cn=computers,cn=accounts,dc=example,dc=com
   cn: h1.example.com
   fqdn: h1.example.com
   l: Brno
   <snip>

The machine moves so I modify the entry:

% ipa host-mod --locality=Berlin h1.example.com

Your first call will leave the attribute as localityname and it will try 
to compare it to 'l', right? So it is still going to add a new value.

rob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090612/2c127d8b/attachment.bin>


More information about the Freeipa-devel mailing list