a2-analyze-ldap-auth-settings: improve table display

This commit is contained in:
Benjamin Dauvergne 2021-10-27 12:10:11 +02:00
parent c7756e8088
commit bcba0f150b
1 changed files with 8 additions and 3 deletions

View File

@ -25,11 +25,16 @@ for tenant, ldap_settings in tenants.items():
continue
key_counters.update(collections.Counter(list(block)))
for key, value in block.items():
if not hasattr(value, '__len__') or isinstance(value, str) and key not in ('url', 'bindpw', 'user_filter', 'basedn', 'binddn') or key == 'external_id_tuples':
if not hasattr(value, '__len__') or isinstance(value, str) and key not in ('url', 'bindpw', 'basedn', 'binddn') or key == 'external_id_tuples':
values[key].add(immutable(value))
for key, count in key_counters.most_common(len(key_counters)):
v = str(values.get(key) or '')
print(f'{key:30s} {count:>4d} {v:>30s}')
v = values.get(key) or set()
if not v:
print(f'{key:30s} {count} values, not shown')
else:
print(f'{key:30s} {count} values')
for i, value in enumerate(list(v)):
print(f'{"":30s} {"":>10s} {value}')