[Freeipa-devel] [PATCHES] 198-202 Refactor indirect membership processing

Petr Viktorin pviktori at redhat.com
Fri Nov 8 14:14:28 UTC 2013


On 10/31/2013 02:45 PM, Jan Cholasta wrote:
> Hi,
>
> the attached patches fix <https://fedorahosted.org/freeipa/ticket/3971>.
>
> Tested with 25000 users.
>
> Honza

Patch 198:

Also update ipaldap's find_entries docstring, it no longer uses IPA 
defaults.


While you're touching this part of code, I had some other improvements 
in mind -- you can consider them:

In find_entries,
     attrs_list = [a.lower() for a in attrs_list]
to make sure 'memberindirect' is case insensitive

In get_memberof, construct `indirect` as a set, for Ο(1) remove().

Changing MEMBERS_ALL et.al. from numbers to descriptive strings, for 
easier debugging.



Patch 199: Looks great


Patch 200:

objtype, res_list, red_id, res_ctrls = result
Minor typo ----------^


This construction won't work as you'd expect in Python 2:

try:
     (possibly raise interesting exception) (*)
except:
     try:
         (possibly raise exception to ignore) (**)
     except:
         pass
     raise  # (***)

The problem is that the exception in (**) overwrites the "current active 
exception" caught in (*). In (***) the exception from cleanup will be 
raised.
The solution is to store the wanted exception info, including the traceback:
     exc_type, exc_value, exc_traceback = sys.exc_info()
and then re-raise explicitly:
     raise exc_type, exc_value, exc_traceback

Also, please log the ignored exception from cancelling the paged search.


-- 
Petr³




More information about the Freeipa-devel mailing list