mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-15 10:51:56 -06:00
Be more exacting when deleting a group.
453222
This commit is contained in:
parent
aead1f652e
commit
3f85a011c6
@ -26,6 +26,7 @@ try:
|
||||
import ipa.ipautil as ipautil
|
||||
import errno
|
||||
import socket
|
||||
import ldap
|
||||
|
||||
import xmlrpclib
|
||||
import kerberos
|
||||
@ -65,15 +66,18 @@ def main():
|
||||
|
||||
counter = groups[0]
|
||||
groups = groups[1:]
|
||||
to_delete = None
|
||||
|
||||
if counter == 0:
|
||||
for i in range(counter):
|
||||
dn_list = ldap.explode_dn(groups[i].dn.lower())
|
||||
if "cn=%s" % args[1].lower() in dn_list:
|
||||
to_delete = groups[i]
|
||||
|
||||
if to_delete is None:
|
||||
print "Group '%s' not found." % args[1]
|
||||
return 2
|
||||
if counter != 1:
|
||||
print "An exact group match was not found. Found %d groups" % counter
|
||||
return 2
|
||||
|
||||
ret = client.delete_group(groups[0].dn)
|
||||
ret = client.delete_group(to_delete.dn)
|
||||
if (ret == "Success"):
|
||||
print args[1] + " successfully deleted"
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user