[Freeipa-devel] [PATCH] 326 Improve compatibility of LDAP rename_s call
Petr Viktorin
pviktori at redhat.com
Thu Oct 25 07:51:50 UTC 2012
On 10/24/2012 08:47 PM, Rob Crittenden wrote:
> Martin Kosek wrote:
>> python-ldap of version 2.3.10 and lower does not support serverctrls
>> and clientctrls options. This makes every rename operation in IPA
>> to crash with Internal Error.
>>
>> Make sure that we respect the difference between both versions in
>> our LDAP module and do not pass serverctrls and clientctrls when
>> they are not supported. NotImplementedException is raised when the
>> options are used with this version.
>>
>> https://fedorahosted.org/freeipa/ticket/3199
>
> This may be overkill, but would it be better to use introspection to
> determine if the arguments are supported?
>
> import ldap
> import inspect
> signature = inspect.getargspec(ldap.ldapobject.LDAPObject.rename_s)
> if 'serverctrls' in signature.args:
> _EXTENDED_RENAME_S = True
> else:
> _EXTENDED_RENAME_S = False
>
> rob
>
Yes, I believe that would be overkill. If the module exports its
version, why not use it.
A simpler solution would be that our wrapper would just not use the
extra arguments at all. We're technically wrapping the old version (or
better) of python-ldap, so I don't see why it would hurt.
It would also have the advantage that we couldn't use the extra
arguments in our code, as opposed to getting errors when someone happens
to try with the old version.
--
Petr³
More information about the Freeipa-devel
mailing list