From 54d2338da60ee3ab73f8bc085ff36baa112ad379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tronel?= Date: Mon, 29 Dec 2025 15:10:21 +0100 Subject: [PATCH] Improve logging when operations are successful. --- refresh-certificate.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/refresh-certificate.py b/refresh-certificate.py index 925c55e..956c406 100755 --- a/refresh-certificate.py +++ b/refresh-certificate.py @@ -446,6 +446,8 @@ def delete_certificate(hostname, verify, username, password, certificates, certi logger.error('Impossible to delete certificate') sys.exit(-1) + logger.info('Certificate deleted with success.') + def main(): """ Main entry point of the program. @@ -595,10 +597,14 @@ def main(): certs = get_certificates(hostname=args.hostname, verify=args.verify, username=args.username, password=args.password) + logger.info('List of certificates:') for certid, cert in certs.items(): subject = cert.get('subject') issuer = cert.get('issuer') - print(f'{certid} - {subject} issued by {issuer}.') + validity = cert.get('validity') + begin = parse(validity.get('fromDate')) + end = parse(validity.get('toDate')) + print(f'{certid} - {subject} issued by {issuer}. From: {begin} to {end}') case 'del': bearer = get_bearer(hostname=args.hostname, verify=args.verify, username=args.username, password=args.password)