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
This commit is contained in:
Petr Viktorin
2013-01-21 07:03:33 -05:00
committed by Martin Kosek
parent 607ff478f5
commit b69f6983e4
3 changed files with 12 additions and 54 deletions

View File

@@ -299,12 +299,10 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
dn = DN(('cn', replica2), ('cn', 'replicas'), ('cn', 'ipa'), ('cn', 'etc'),
ipautil.realm_to_suffix(realm))
entries = repl1.conn.getList(dn, ldap.SCOPE_SUBTREE)
if len(entries) != 0:
dnset = repl1.conn.get_dns_sorted_by_length(entries,
reverse=True)
for dns in dnset:
for dn in dns:
repl1.conn.deleteEntry(dn)
if entries:
entries.sort(key=len, reverse=True)
for dn in entries:
repl1.conn.deleteEntry(dn)
except Exception, e:
print "Error deleting winsync replica shared info: %s" % convert_error(e)