summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2012-02-01 13:10:09 -0500
committerRob Crittenden <rcritten@redhat.com>2012-02-13 22:24:34 -0500
commit9625bf4a0ddf97fb849ea960b349dbffba37eada (patch)
tree2e208e7a7d171608f47abcc65a6b322dcbee6f23
parentdc5c6b18212e35b420572184d25056415ffeedc5 (diff)
downloadfreeipa.git-9625bf4a0ddf97fb849ea960b349dbffba37eada.tar.gz
freeipa.git-9625bf4a0ddf97fb849ea960b349dbffba37eada.tar.xz
freeipa.git-9625bf4a0ddf97fb849ea960b349dbffba37eada.zip
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
-rw-r--r--ipaserver/ipaldap.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index 6924cfb4..cf19beee 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -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