Explicit error message for #2206

This commit is contained in:
Seth Schoen 2016-02-18 16:02:07 -08:00
parent 9b21efc6b8
commit 1de66b3d7d
2 changed files with 14 additions and 0 deletions

View file

@ -649,6 +649,11 @@ def record_chosen_plugins(config, plugins, auth, inst):
# Possible difficulties: config.csr was hacked into auth
def run(config, plugins): # pylint: disable=too-many-branches,too-many-locals
"""Obtain a certificate and install."""
if config.csr is not None:
raise errors.Error("Currently, the default 'run' verb cannot be used "
"when specifying a CSR file. Please try the "
"certonly command instead.")
try:
installer, authenticator = choose_configurator_plugins(config, plugins, "run")
except errors.PluginSelectionError as e:

View file

@ -356,6 +356,15 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
self._call,
['-d', '204.11.231.35'])
def test_run_with_csr(self):
# This is an error because you can only use --csr with certonly
try:
self._call(['--csr', CSR])
except errors.Error as e:
assert "Please try the certonly" in e.message
return
assert False, "Expected supplying --csr to fail with default verb"
def _get_argument_parser(self):
plugins = disco.PluginsRegistry.find_all()
return functools.partial(cli.prepare_and_parse_args, plugins)