Address review comments

This commit is contained in:
Peter Eckersley
2016-03-24 17:51:48 -07:00
parent c1844b61c1
commit 7b434c5a88
3 changed files with 7 additions and 9 deletions
+4 -4
View File
@@ -32,7 +32,7 @@ from letsencrypt import storage
from letsencrypt.display import util as display_util, ops as display_ops from letsencrypt.display import util as display_util, ops as display_ops
from letsencrypt.plugins import disco as plugins_disco from letsencrypt.plugins import disco as plugins_disco
from letsencrypt.plugins import selection as ps from letsencrypt.plugins import selection as plug_sel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -407,7 +407,7 @@ def install(config, plugins):
# this function ... # this function ...
try: try:
installer, _ = ps.choose_configurator_plugins(config, plugins, "install") installer, _ = plug_sel.choose_configurator_plugins(config, plugins, "install")
except errors.PluginSelectionError as e: except errors.PluginSelectionError as e:
return e.message return e.message
@@ -482,7 +482,7 @@ def run(config, plugins): # pylint: disable=too-many-branches,too-many-locals
# TODO: Make run as close to auth + install as possible # TODO: Make run as close to auth + install as possible
# Possible difficulties: config.csr was hacked into auth # Possible difficulties: config.csr was hacked into auth
try: try:
installer, authenticator = ps.choose_configurator_plugins(config, plugins, "run") installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "run")
except errors.PluginSelectionError as e: except errors.PluginSelectionError as e:
return e.message return e.message
@@ -512,7 +512,7 @@ def obtain_cert(config, plugins, lineage=None):
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
try: try:
# installers are used in auth mode to determine domain names # installers are used in auth mode to determine domain names
installer, authenticator = ps.choose_configurator_plugins(config, plugins, "certonly") installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, "certonly")
except errors.PluginSelectionError as e: except errors.PluginSelectionError as e:
logger.info("Could not choose appropriate plugin: %s", e) logger.info("Could not choose appropriate plugin: %s", e)
raise raise
+1 -3
View File
@@ -132,8 +132,6 @@ def choose_plugin(prepared, question):
else: else:
return None return None
logger = logging.getLogger(__name__)
noninstaller_plugins = ["webroot", "manual", "standalone"] noninstaller_plugins = ["webroot", "manual", "standalone"]
def record_chosen_plugins(config, plugins, auth, inst): def record_chosen_plugins(config, plugins, auth, inst):
@@ -146,7 +144,7 @@ def record_chosen_plugins(config, plugins, auth, inst):
def choose_configurator_plugins(config, plugins, verb): def choose_configurator_plugins(config, plugins, verb):
""" """
Figure out which configurator we're going to use, modifies Figure out which configurator we're going to use, modifies
config.authenticator and config.istaller strings to reflect that choice if config.authenticator and config.installer strings to reflect that choice if
necessary. necessary.
:raises errors.PluginSelectionError if there was a problem :raises errors.PluginSelectionError if there was a problem
+2 -2
View File
@@ -203,8 +203,8 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
self.assertEqual(args.chain_path, os.path.abspath(chain)) self.assertEqual(args.chain_path, os.path.abspath(chain))
self.assertEqual(args.fullchain_path, os.path.abspath(fullchain)) self.assertEqual(args.fullchain_path, os.path.abspath(fullchain))
@mock.patch('letsencrypt.main.ps.record_chosen_plugins') @mock.patch('letsencrypt.main.plug_sel.record_chosen_plugins')
@mock.patch('letsencrypt.main.ps.pick_installer') @mock.patch('letsencrypt.main.plug_sel.pick_installer')
def test_installer_selection(self, mock_pick_installer, _rec): def test_installer_selection(self, mock_pick_installer, _rec):
self._call(['install', '--domains', 'foo.bar', '--cert-path', 'cert', self._call(['install', '--domains', 'foo.bar', '--cert-path', 'cert',
'--key-path', 'key', '--chain-path', 'chain']) '--key-path', 'key', '--chain-path', 'chain'])