Remove pointless question (#3526)

* remove unhelpful question about servernames and default vhosts

* add prefix about names found in config files

* test we include configuration files prefix

* Tell the user what kind of conf files were missing domains

* Revert "Tell the user what kind of conf files were missing domains"

This reverts commit 1066a88dae.
This commit is contained in:
Brad Warren 2016-09-28 15:52:08 -07:00 committed by Peter Eckersley
parent b65ea31b42
commit 769ebfce5e
2 changed files with 13 additions and 22 deletions

View file

@ -103,18 +103,8 @@ def choose_names(installer):
names = get_valid_domains(domains)
if not names:
manual = z_util(interfaces.IDisplay).yesno(
"No names were found in your configuration files.{0}You should "
"specify ServerNames in your config files in order to allow for "
"accurate installation of your certificate.{0}"
"If you do use the default vhost, you may specify the name "
"manually. Would you like to continue?{0}".format(os.linesep),
default=True)
if manual:
return _choose_names_manually()
else:
return []
return _choose_names_manually(
"No names were found in your configuration files. ")
code, names = _filter_names(names)
if code == display_util.OK and names:
@ -157,10 +147,17 @@ def _filter_names(names):
return code, [str(s) for s in names]
def _choose_names_manually():
"""Manually input names for those without an installer."""
def _choose_names_manually(prompt_prefix=""):
"""Manually input names for those without an installer.
:param str prompt_prefix: string to prepend to prompt for domains
:returns: list of provided names
:rtype: `list` of `str`
"""
code, input_ = z_util(interfaces.IDisplay).input(
prompt_prefix +
"Please enter in your domain name(s) (comma and/or space separated) ",
cli_flag="--domains")

View file

@ -206,20 +206,14 @@ class ChooseNamesTest(unittest.TestCase):
@mock.patch("certbot.display.ops.z_util")
def test_no_names_choose(self, mock_util):
self.mock_install().get_all_names.return_value = set()
mock_util().yesno.return_value = True
domain = "example.com"
mock_util().input.return_value = (display_util.OK, domain)
actual_doms = self._call(self.mock_install)
self.assertEqual(mock_util().input.call_count, 1)
self.assertEqual(actual_doms, [domain])
@mock.patch("certbot.display.ops.z_util")
def test_no_names_quit(self, mock_util):
self.mock_install().get_all_names.return_value = set()
mock_util().yesno.return_value = False
self.assertEqual(self._call(self.mock_install), [])
self.assertTrue(
"configuration files" in mock_util().input.call_args[0][0])
@mock.patch("certbot.display.ops.z_util")
def test_filter_names_valid_return(self, mock_util):