summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-01-21 07:03:33 -0500
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:44 +0100
commitb69f6983e4bb01e2af63c4b02a0ab79b24e59569 (patch)
treea3c3c69a55b2b82bb1a536a7b527cbe0169f0561 /ipaserver/install
parent607ff478f55e330ab68744beb699dc96d6a5f94a (diff)
downloadfreeipa-b69f6983e4bb01e2af63c4b02a0ab79b24e59569.tar.gz
freeipa-b69f6983e4bb01e2af63c4b02a0ab79b24e59569.tar.xz
freeipa-b69f6983e4bb01e2af63c4b02a0ab79b24e59569.zip
Remove IPAdmin.get_dns_sorted_by_length
A simple sort(key=len) is simpler both implementation-wise and semantics-wise. Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/replication.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 1555fb993..d604cf7b3 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -1066,12 +1066,10 @@ class ReplicationManager(object):
filter='(krbprincipalname=*/%s@%s)' % (replica, realm)
entries = self.conn.getList(self.suffix, ldap.SCOPE_SUBTREE,
filterstr=filter)
- if len(entries) != 0:
- dnset = self.conn.get_dns_sorted_by_length(entries,
- reverse=True)
- for dns in dnset:
- for dn in dns:
- self.conn.deleteEntry(dn)
+ if entries:
+ entries.sort(key=len, reverse=True)
+ for dn in entries:
+ self.conn.deleteEntry(dn)
except errors.NotFound:
pass
except Exception, e:
@@ -1109,12 +1107,10 @@ class ReplicationManager(object):
try:
dn = DN(('cn', replica), ('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'), self.suffix)
entries = self.conn.getList(dn, ldap.SCOPE_SUBTREE)
- if len(entries) != 0:
- dnset = self.conn.get_dns_sorted_by_length(entries,
- reverse=True)
- for dns in dnset:
- for dn in dns:
- self.conn.deleteEntry(dn)
+ if entries:
+ entries.sort(key=len, reverse=True)
+ for dn in entries:
+ self.conn.deleteEntry(dn)
except errors.NotFound:
pass
except Exception, e: