mirror of
https://github.com/certbot/certbot.git
synced 2026-07-28 00:24:35 +02:00
Merge pull request #1100 from letsencrypt/971
Pass plugin errors back out to the user.
This commit is contained in:
+2
-1
@@ -352,7 +352,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!r}"
|
||||
.format(requested, plugins[requested].problem))
|
||||
elif cfg_type == "installer":
|
||||
if os.path.exists("/etc/debian_version"):
|
||||
# Debian... installers are at least possible
|
||||
|
||||
@@ -120,6 +120,13 @@ 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
|
||||
return None
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Is plugin available, i.e. prepared or misconfigured?"""
|
||||
|
||||
@@ -68,6 +68,7 @@ class PluginEntryPointTest(unittest.TestCase):
|
||||
self.assertFalse(self.plugin_ep.prepared)
|
||||
self.assertFalse(self.plugin_ep.misconfigured)
|
||||
self.assertFalse(self.plugin_ep.available)
|
||||
self.assertTrue(self.plugin_ep.problem is None)
|
||||
self.assertTrue(self.plugin_ep.entry_point is EP_SA)
|
||||
self.assertEqual("sa", self.plugin_ep.name)
|
||||
|
||||
@@ -131,6 +132,8 @@ class PluginEntryPointTest(unittest.TestCase):
|
||||
errors.MisconfigurationError))
|
||||
self.assertTrue(self.plugin_ep.prepared)
|
||||
self.assertTrue(self.plugin_ep.misconfigured)
|
||||
self.assertTrue(isinstance(self.plugin_ep.problem,
|
||||
errors.MisconfigurationError))
|
||||
self.assertTrue(self.plugin_ep.available)
|
||||
|
||||
def test_prepare_no_installation(self):
|
||||
|
||||
Reference in New Issue
Block a user