Requested fixes

This commit is contained in:
Joona Hoikkala 2018-02-23 21:38:40 +02:00
parent 49b2d4ac07
commit 95a83515be
No known key found for this signature in database
GPG key ID: 1708DAE66E87A524
5 changed files with 12 additions and 8 deletions

View file

@ -1384,10 +1384,10 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
msg_tmpl = ("Certbot was not able to find SSL VirtualHost for a "
"domain {0} for enabling enhancement \"{1}\". The requested "
"enhancement was not configured.")
msg_enhancement = enhancement
if options:
msg = msg_tmpl.format(domain, options)
else:
msg = msg_tmpl.format(domain, enhancement)
msg_enhancement += ": " + options
msg = msg_tmpl.format(domain, msg_enhancement)
logger.warning(msg)
else:
func(vhost, options)

View file

@ -1118,7 +1118,7 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False): # pylint: dis
"security", "--no-uir", action="store_false", dest="uir", default=flag_default("uir"),
help=argparse.SUPPRESS)
helpful.add(
["security", "enhance"], "--staple-ocsp", action="store_true", dest="staple",
"security", "--staple-ocsp", action="store_true", dest="staple",
default=flag_default("staple"),
help="Enables OCSP Stapling. A valid OCSP response is stapled to"
" the certificate that the server offers during TLS.")

View file

@ -875,7 +875,7 @@ def enhance(config, plugins):
:rtype: None
"""
supported_enhancements = ["hsts", "redirect", "staple", "uir"]
supported_enhancements = ["hsts", "redirect", "uir"]
# Check that at least one enhancement was requested on command line
if not any([getattr(config, enh) for enh in supported_enhancements]):
msg = ("Please specify one or more enhancement types to configure. To list "

View file

@ -161,8 +161,12 @@ def choose_configurator_plugins(config, plugins, verb):
req_auth, req_inst = cli_plugin_requests(config)
installer_question = ("How would you like to authenticate and install "
"certificates?")
if verb == "enhance":
installer_question = ("Which plugin would you like to use for adding "
"security enhancements to your configuration?")
else:
installer_question = ("How would you like to authenticate and install "
"certificates?")
# Which plugins do we need?
if verb == "run":

View file

@ -1588,7 +1588,7 @@ class EnhanceTest(unittest.TestCase):
'-d', 'another.tld', '--redirect',
'--hsts'])
req_enh = ["redirect", "hsts"]
not_req_enh = ["staple", "uir"]
not_req_enh = ["uir"]
self.assertTrue(mock_client.enhance_config.called)
self.assertTrue(
all([getattr(mock_client.config, e) for e in req_enh]))