Pass plugin errors back out to the user.

Closes: #971
This commit is contained in:
Peter Eckersley
2015-10-23 17:17:23 -07:00
parent dd1e000581
commit a567c0578f
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -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
+6
View File
@@ -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?"""