Properly handle None value for installer in updater

This commit is contained in:
Joona Hoikkala 2018-07-10 10:43:25 +03:00
parent 43f2bfd6f1
commit 50cb6975bc
No known key found for this signature in database
GPG key ID: 1708DAE66E87A524
2 changed files with 12 additions and 0 deletions

View file

@ -263,6 +263,10 @@ def cli_plugin_requests(config): # pylint: disable=too-many-branches
:rtype: tuple
"""
req_inst = req_auth = config.configurator
if config.installer == 'None':
config.installer = None
if config.authenticator == 'None':
config.authenticator = None
req_inst = set_configurator(req_inst, config.installer)
req_auth = set_configurator(req_auth, config.authenticator)

View file

@ -215,6 +215,14 @@ class GetUnpreparedInstallerTest(test_util.ConfigTestCase):
self.mock_apache_fail_ep.name = "apache"
self.assertRaises(errors.PluginSelectionError, self._call)
def test_return_early_if_none(self):
self.config.installer = 'None'
# Make sure that the function returns early. PluginsRegistry.filter is
# called right after we should return.
with mock.patch('certbot.plugins.disco.PluginsRegistry.filter') as mock_f:
self._call()
self.assertFalse(mock_f.called)
if __name__ == "__main__":
unittest.main() # pragma: no cover