Fix issue with ssh certs with less than 2 principals

This commit is contained in:
Benjamin Collet 2025-01-20 20:32:53 +01:00
parent d8a63b8ee0
commit 493a9dab30
Signed by: bcollet
SSH key fingerprint: SHA256:8UJspOIcCOS+MtSOcnuq2HjKFube4ox1s/+A62ixov4

View file

@ -41,6 +41,8 @@ def list_ssh_certs(sort_key, revoked=False, expired=False):
principals_list = [x.decode() for x in cert.principals]
if principals_count > 2:
principals = principals_list[:2] + [f"+{principals_count - 2} more"]
else:
principals = principals_list
cert_row["Principals"] = "\n".join(principals)
now_with_tz = datetime.utcnow().replace(