From a567c0578f8f241e94f3d7652ba020bb7e216ec1 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Fri, 23 Oct 2015 17:17:23 -0700 Subject: [PATCH] Pass plugin errors back out to the user. Closes: #971 --- letsencrypt/cli.py | 3 ++- letsencrypt/plugins/disco.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 822f231ef..2aedeea8f 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -351,7 +351,8 @@ def diagnose_configurator_problem(cfg_type, requested, plugins): msg = "The requested {0} plugin does not appear to be installed".format(requested) else: msg = ("The {0} plugin is not working; there may be problems with " - "your existing configuration").format(requested) + "your existing configuration.\nThe error was: {1}" + .format(requested, plugins[requested].problem)) elif cfg_type == "installer": if os.path.exists("/etc/debian_version"): # Debian... installers are at least possible diff --git a/letsencrypt/plugins/disco.py b/letsencrypt/plugins/disco.py index 5a41fda88..3f26206c7 100644 --- a/letsencrypt/plugins/disco.py +++ b/letsencrypt/plugins/disco.py @@ -120,6 +120,12 @@ class PluginEntryPoint(object): """Is plugin misconfigured?""" return isinstance(self._prepared, errors.MisconfigurationError) + @property + def problem(self): + """Return the Exception raised during plugin setup, or None if all is well""" + if isinstance(self._prepared, Exception): + return self._prepared + @property def available(self): """Is plugin available, i.e. prepared or misconfigured?"""