From 406a604d636fcb0fdb5cba870a5a1d40710a883e Mon Sep 17 00:00:00 2001 From: Harry Kodden Date: Thu, 9 Nov 2023 14:29:52 +0100 Subject: [PATCH] nav stress testem, paar fixes --- plsc_ordered.py | 16 ++++++++++++---- util.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/plsc_ordered.py b/plsc_ordered.py index f09008e..a95018d 100755 --- a/plsc_ordered.py +++ b/plsc_ordered.py @@ -501,7 +501,10 @@ def cleanup(dst): logging.info(" - People") src_members = vc.get(dc, {}).get(co, {}).get('members', []) dst_dns = dst.rfind( - "ou=people,o={},dc=ordered,dc={}".format(co, escape_dn_chars(service)), + "ou=people,o={},dc=ordered,dc={}".format( + co, + escape_dn_chars(service) + ), '(objectClass=person)' ) for dst_dn, dst_entry in dst_dns.items(): @@ -509,7 +512,7 @@ def cleanup(dst): if dst_entry.get('eduPersonUniqueId', None): dst_uid = dst_entry['eduPersonUniqueId'][0] if dst_uid not in src_members: - logging.debug(" dst_uid not found in src_members, deleting {}".format(dst_dn)) + logging.info(" dst_uid not found in {}, deleting {}".format(src_members, dst_dn)) dst.delete(dst_dn) else: # verify that rdn uid is indeed (still) valid registered user, if not delete entry @@ -517,8 +520,13 @@ def cleanup(dst): dst.delete(dst_dn) logging.info(" - Groups") - dst_dns = dst.rfind("ou=Groups,o={},dc=ordered,dc={}".format(co, escape_dn_chars(service)), - '(objectClass=groupOfMembers)') + dst_dns = dst.rfind( + "ou=Groups,o={},dc=ordered,dc={}".format( + co, + escape_dn_chars(service) + ), + '(objectClass=groupOfMembers)' + ) for dst_dn, dst_entry in dst_dns.items(): grp_name = dst_entry['cn'][0] if grp_name not in vc.get(dc, {}).get(co, {}).get('groups', []): diff --git a/util.py b/util.py index 9b0167b..a086b94 100644 --- a/util.py +++ b/util.py @@ -12,7 +12,7 @@ def make_secret(password): return '{SSHA}' + crypted.decode('ascii') -SPECIAL_DN_CHARACTERS = "\\,+<>;\"=#" +SPECIAL_DN_CHARACTERS = "\\,+<>;\"= " SPECIAL_FILTER_CHARACTERS = "*()"