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])