From 1f4f1fdf39e83757d53577e3203f478446fac76d Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Fri, 1 Apr 2016 18:22:07 -0700 Subject: [PATCH] Verbosity tuning --- letsencrypt/renewal.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/letsencrypt/renewal.py b/letsencrypt/renewal.py index f0edd55fe..af4bbca1e 100644 --- a/letsencrypt/renewal.py +++ b/letsencrypt/renewal.py @@ -203,12 +203,12 @@ def should_renew(config, lineage): def _renew_describe_results(config, renew_successes, renew_failures, renew_skipped, parse_failures): def notify(msg): - "Our version of print()" + "A variant of print() that is silenced by -q" zope.component.getUtility(interfaces.IDisplay).notification(msg, pause=False) def report(msgs, category): "Report results for a category of renewal outcomes" - notify(" " + "\n ".join("%s (%s)" % (m, category) for m in msgs)) + return " " + "\n ".join("%s (%s)" % (m, category) for m in msgs) if config.dry_run: notify("** DRY RUN: simulating 'letsencrypt renew' close to cert expiry") @@ -216,27 +216,27 @@ def _renew_describe_results(config, renew_successes, renew_failures, notify("") if renew_skipped: notify("The following certs are not due for renewal yet:") - report(renew_skipped, "skipped") + notify(report(renew_skipped, "skipped")) if not renew_successes and not renew_failures: notify("No renewals were attempted.") elif renew_successes and not renew_failures: notify("Congratulations, all renewals succeeded. The following certs " "have been renewed:") - report(renew_successes, "success") + notify(report(renew_successes, "success")) elif renew_failures and not renew_successes: - notify("All renewal attempts failed. The following certs could not be " + logger.error("All renewal attempts failed. The following certs could not be " "renewed:") - report(renew_failures, "failure") + logger.error(report(renew_failures, "failure")) elif renew_failures and renew_successes: - notify("The following certs were successfully renewed:") - report(renew_successes, "success") - notify("\nThe following certs could not be renewed:") - report(renew_failures, "failure") + logger.error("The following certs were successfully renewed:") + logger.error(report(renew_successes, "success")) + logger.error("\nThe following certs could not be renewed:") + logger.error(renew_failures, "failure") if parse_failures: - notify("\nAdditionally, the following renewal configuration files " - "were invalid: ") - report(parse_failures, "parsefail") + logger.error("\nAdditionally, the following renewal configuration files " + "were invalid: ") + logger.error(parse_failures, "parsefail") if config.dry_run: notify("** DRY RUN: simulating 'letsencrypt renew' close to cert expiry")