Don't use quoted None for plugins in the config (#6195)

This stops us from printing messages like:

"Could not choose appropriate plugin for updaters: Could not select or initialize the requested installer None."

when certbot renew --force-renewal is run with a lineage that doesn't have an installer.

* unquote None

* Test None values aren't saved in config file.
This commit is contained in:
Brad Warren 2018-07-10 14:42:27 -07:00 committed by GitHub
parent 9314911135
commit 3b39266813
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -1064,7 +1064,7 @@ def revoke(config, unused_plugins): # TODO: coop with renewal config
"""
# For user-agent construction
config.installer = config.authenticator = "None"
config.installer = config.authenticator = None
if config.key_path is not None: # revocation by cert key
logger.debug("Revoking %s using cert key %s",
config.cert_path[0], config.key_path[0])

View file

@ -170,8 +170,8 @@ noninstaller_plugins = ["webroot", "manual", "standalone", "dns-cloudflare", "dn
def record_chosen_plugins(config, plugins, auth, inst):
"Update the config entries to reflect the plugins we actually selected."
config.authenticator = plugins.find_init(auth).name if auth else "None"
config.installer = plugins.find_init(inst).name if inst else "None"
config.authenticator = plugins.find_init(auth).name if auth else None
config.installer = plugins.find_init(inst).name if inst else None
logger.info("Plugins selected: Authenticator %s, Installer %s",
config.authenticator, config.installer)

View file

@ -545,8 +545,9 @@ class RenewableCertTests(BaseRenewableCertTest):
def _test_relevant_values_common(self, values):
defaults = dict((option, cli.flag_default(option))
for option in ("rsa_key_size", "server",))
mock_parser = mock.Mock(args=["--standalone"], verb="certonly",
for option in ("authenticator", "installer",
"rsa_key_size", "server",))
mock_parser = mock.Mock(args=[], verb="plugins",
defaults=defaults)
# make a copy to ensure values isn't modified
@ -588,6 +589,11 @@ class RenewableCertTests(BaseRenewableCertTest):
self.assertEqual(
self._test_relevant_values_common(values), values)
def test_relevant_values_plugins_none(self):
self.assertEqual(
self._test_relevant_values_common(
{"authenticator": None, "installer": None}), {})
@mock.patch("certbot.cli.set_by_cli")
@mock.patch("certbot.plugins.disco.PluginsRegistry.find_all")
def test_relevant_values_namespace(self, mock_find_all, mock_set_by_cli):