From c3d1a6c4b197132bef7cf6b5c05987d3f468dc14 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 20 Aug 2024 15:08:57 +0200 Subject: [PATCH] proxmox: fix handling empty values in LDAP sync script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t put "None" for email and such. --- roles/proxmox/templates/sync-ldap.py.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/proxmox/templates/sync-ldap.py.j2 b/roles/proxmox/templates/sync-ldap.py.j2 index 4448d90..6c216b5 100644 --- a/roles/proxmox/templates/sync-ldap.py.j2 +++ b/roles/proxmox/templates/sync-ldap.py.j2 @@ -33,7 +33,7 @@ all_users = {} all_groups = collections.defaultdict(set) for e in ldap.entries: user = f'{e.userPrincipalName.value}@{realm}' - all_users[user] = { k: e[k].value for k in e.entry_attributes } + all_users[user] = { k: (e[k].value or '') for k in e.entry_attributes } for group in e.memberOf: if m := re.match(r'^CN=([^,]*)', group.replace('\\,', '-')): group = re.sub(r'[^A-Za-z0-9_.-]', '-', m[1])