fix certbot plugins output (#9488)

This commit is contained in:
Brad Warren 2022-11-30 13:56:09 -08:00 committed by GitHub
parent fe5e56a52c
commit 8390c65a95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 21 deletions

View file

@ -14,6 +14,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
### Fixed
* Interfaces which plugins register themselves as implementing without inheriting from them now show up in `certbot plugins` output.
* `IPluginFactory`, `IPlugin`, `IAuthenticator` and `IInstaller` have been re-added to
`certbot.interfaces`.
- This is to fix compatibility with a number of third-party DNS plugins which may

View file

@ -24,25 +24,9 @@ from certbot.errors import Error
logger = logging.getLogger(__name__)
PREFIX_FREE_DISTRIBUTIONS = [
"certbot",
"certbot-apache",
"certbot-dns-cloudflare",
"certbot-dns-digitalocean",
"certbot-dns-dnsimple",
"certbot-dns-dnsmadeeasy",
"certbot-dns-gehirn",
"certbot-dns-google",
"certbot-dns-linode",
"certbot-dns-luadns",
"certbot-dns-nsone",
"certbot-dns-ovh",
"certbot-dns-rfc2136",
"certbot-dns-route53",
"certbot-dns-sakuracloud",
"certbot-nginx",
]
"""Distributions for which prefix will be omitted."""
PLUGIN_INTERFACES = [interfaces.Authenticator, interfaces.Installer, interfaces.Plugin]
"""Interfaces that should be listed in `certbot plugins` output"""
class PluginEntryPoint:
@ -165,8 +149,8 @@ class PluginEntryPoint:
"* {0}".format(self.name),
"Description: {0}".format(self.plugin_cls.description),
"Interfaces: {0}".format(", ".join(
cls.__name__ for cls in self.plugin_cls.mro()
if cls.__module__ == 'certbot.interfaces'
iface.__name__ for iface in PLUGIN_INTERFACES
if issubclass(self.plugin_cls, iface)
)),
"Entry point: {0}".format(self.entry_point),
]

View file

@ -152,6 +152,12 @@ class PluginEntryPointTest(unittest.TestCase):
self.assertIs(self.plugin_ep.misconfigured, False)
self.assertIs(self.plugin_ep.available, False)
def test_str(self):
output = str(self.plugin_ep)
self.assertIn("Authenticator", output)
self.assertNotIn("Installer", output)
self.assertIn("Plugin", output)
def test_repr(self):
self.assertEqual("PluginEntryPoint#sa", repr(self.plugin_ep))