From ae2247163e42934c0486c36079bc7ae50bc4d4e2 Mon Sep 17 00:00:00 2001 From: osirisinferi Date: Sun, 21 Mar 2021 22:42:23 +0100 Subject: [PATCH] Remove empty lines from `certbot certificates` when (#8723) .. envoked with `--cert-name` or `-d`. --- certbot/CHANGELOG.md | 3 ++- certbot/certbot/_internal/cert_manager.py | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index 62bceb74d..9b37e9a1a 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -17,7 +17,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). ### Fixed -* +* Don't output an empty line for a hidden certificate when `certbot certificates` is being used + in combination with `--cert-name` or `-d`. More details about these changes can be found on our GitHub repo. diff --git a/certbot/certbot/_internal/cert_manager.py b/certbot/certbot/_internal/cert_manager.py index 8fab5735a..b9b4ad2d7 100644 --- a/certbot/certbot/_internal/cert_manager.py +++ b/certbot/certbot/_internal/cert_manager.py @@ -266,9 +266,9 @@ def human_readable_cert_info(config, cert, skip_filter_checks=False): checker = ocsp.RevocationChecker() if config.certname and cert.lineagename != config.certname and not skip_filter_checks: - return "" + return None if config.domains and not set(config.domains).issubset(cert.names()): - return "" + return None now = pytz.UTC.fromutc(datetime.datetime.utcnow()) reasons = [] @@ -358,7 +358,9 @@ def _report_human_readable(config, parsed_certs): """Format a results report for a parsed cert""" certinfo = [] for cert in parsed_certs: - certinfo.append(human_readable_cert_info(config, cert)) + cert_info = human_readable_cert_info(config, cert) + if cert_info is not None: + certinfo.append(cert_info) return "\n".join(certinfo)