From 87d24d530a5b652938d0aaa73564646d48f7fdcd Mon Sep 17 00:00:00 2001 From: "Ian H. Pittwood" Date: Tue, 10 Dec 2019 08:49:52 -0600 Subject: [PATCH] Add cert name to check-pki-certs command Adds a table column for the certificate name. Each row of data will now be printed with the file name, certificate name, and certificate expiration date. Change-Id: I088ba2e794f33cd858f36275d00dd431862f1c25 --- pegleg/engine/secrets.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pegleg/engine/secrets.py b/pegleg/engine/secrets.py index 6970f2ed..2738f259 100644 --- a/pegleg/engine/secrets.py +++ b/pegleg/engine/secrets.py @@ -235,7 +235,7 @@ def check_cert_expiry(site_name, duration=60): pki_util = PKIUtility(duration=duration) # Create a table to output expired/expiring certs for this site. cert_table = PrettyTable() - cert_table.field_names = ['cert_name', 'expiration_date'] + cert_table.field_names = ['file', 'cert_name', 'expiration_date'] s = definition.site_files(site_name) for doc in s: @@ -250,7 +250,11 @@ def check_cert_expiry(site_name, duration=60): cert = result['data'] cert_info = pki_util.check_expiry(cert) if cert_info['expired'] is True: - cert_table.add_row([doc, cert_info['expiry_date']]) + cert_table.add_row( + [ + doc, result['metadata']['name'], + cert_info['expiry_date'] + ]) # Return table of cert names and expiration dates that are expiring return cert_table.get_string()