mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-27 16:46:42 -06:00
Don't use sets when calculating the modlist so order is preserved.
This is for the LDAP updater in particular. When adding new schema order can be important when one objectclass depends on another via SUP. This calculation will preserve the order of changes in the update file. Discovered trying to add SSH schema. https://fedorahosted.org/freeipa/ticket/754
This commit is contained in:
parent
6488378764
commit
431286a0f6
@ -554,16 +554,17 @@ class IPAdmin(IPAEntryLDAPObject):
|
||||
if not(isinstance(new_values,list) or isinstance(new_values,tuple)):
|
||||
new_values = [new_values]
|
||||
new_values = filter(lambda value:value!=None, new_values)
|
||||
new_values = set(new_values)
|
||||
|
||||
old_values = old_entry.get(key, [])
|
||||
if not(isinstance(old_values,list) or isinstance(old_values,tuple)):
|
||||
old_values = [old_values]
|
||||
old_values = filter(lambda value:value!=None, old_values)
|
||||
old_values = set(old_values)
|
||||
|
||||
adds = list(new_values.difference(old_values))
|
||||
removes = list(old_values.difference(new_values))
|
||||
# We used to convert to sets and use difference to calculate
|
||||
# the changes but this did not preserve order which is important
|
||||
# particularly for schema
|
||||
adds = [x for x in new_values if x not in old_values]
|
||||
removes = [x for x in old_values if x not in new_values]
|
||||
|
||||
if len(adds) == 0 and len(removes) == 0:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user