Incorporated jdkasten's feedback

This commit is contained in:
Brad Warren
2015-06-24 18:24:54 -07:00
parent 76d12e5e34
commit d15a386f92
3 changed files with 32 additions and 33 deletions
+28 -28
View File
@@ -487,32 +487,32 @@ def is_preferred(offered_challb, satisfied,
_ERROR_HELP_COMMON = ( _ERROR_HELP_COMMON = (
'To fix these errors, please make sure that your domain name was entered ' "To fix these errors, please make sure that your domain name was entered "
'correctly and the DNS A/AAAA record(s) for that domain contains the ' "correctly and the DNS A/AAAA record(s) for that domain contains the "
'right IP address.') "right IP address.")
_ERROR_HELP = { _ERROR_HELP = {
'connection' : "connection" :
_ERROR_HELP_COMMON + ' Additionally, please check that your computer ' _ERROR_HELP_COMMON + " Additionally, please check that your computer "
'has publicly routable IP address and no firewalls are preventing the ' "has publicly routable IP address and no firewalls are preventing the "
'server from communicating with the client.', "server from communicating with the client.",
'dnssec' : "dnssec" :
_ERROR_HELP_COMMON + ' Additionally, if you have DNSSEC enabled for ' _ERROR_HELP_COMMON + " Additionally, if you have DNSSEC enabled for "
'your domain, please ensure the signature is valid.', "your domain, please ensure the signature is valid.",
'malformed' : "malformed" :
'To fix these errors, please make sure that you did not provide any ' "To fix these errors, please make sure that you did not provide any "
'invalid information to the client and try running Let\'s Encrypt ' "invalid information to the client and try running Let's Encrypt "
'again.', "again.",
'serverInternal' : "serverInternal" :
'Unfortunately, an error on the ACME server prevented you from completing ' "Unfortunately, an error on the ACME server prevented you from completing "
'authorization. Please try again later.', "authorization. Please try again later.",
'tls' : "tls" :
_ERROR_HELP_COMMON + ' Additionally, please check that you have an up ' _ERROR_HELP_COMMON + " Additionally, please check that you have an up "
'to date TLS configuration that allows the server to communicate with ' "to date TLS configuration that allows the server to communicate with "
'the Let\'s Encrypt client.', "the Let's Encrypt client.",
'unauthorized' : _ERROR_HELP_COMMON, "unauthorized" : _ERROR_HELP_COMMON,
'unknownHost' : _ERROR_HELP_COMMON,} "unknownHost" : _ERROR_HELP_COMMON,}
def _report_failed_challs(failed_achalls): def _report_failed_challs(failed_achalls):
@@ -552,12 +552,12 @@ def _generate_failed_chall_msg(failed_achalls):
for achall in failed_achalls: for achall in failed_achalls:
problems.setdefault(achall.error.description, set()).add(achall.domain) problems.setdefault(achall.error.description, set()).add(achall.domain)
for problem in problems: for problem in problems:
msg.append('\n\nDomains: ') msg.append("\n\nDomains: ")
msg.append(', '.join(sorted(problems[problem]))) msg.append(", ".join(sorted(problems[problem])))
msg.append('\nError: {0}'.format(problem)) msg.append("\nError: {0}".format(problem))
if typ in _ERROR_HELP: if typ in _ERROR_HELP:
msg.append('\n\n') msg.append("\n\n")
msg.append(_ERROR_HELP[typ]) msg.append(_ERROR_HELP[typ])
return ''.join(msg) return "".join(msg)
+3 -4
View File
@@ -46,10 +46,9 @@ class Reporter(object):
printed if the program exits abnormally. printed if the program exits abnormally.
""" """
if msg: assert self.HIGH_PRIORITY <= priority <= self.LOW_PRIORITY
assert self.HIGH_PRIORITY <= priority <= self.LOW_PRIORITY self.messages.put(self._msg_type(priority, msg, on_crash))
self.messages.put(self._msg_type(priority, msg, on_crash)) logging.info("Reporting to user: %s", msg)
logging.info("Reporting to user: %s", msg)
def atexit_print_messages(self, pid=os.getpid()): def atexit_print_messages(self, pid=os.getpid()):
"""Function to be registered with atexit to print messages. """Function to be registered with atexit to print messages.
+1 -1
View File
@@ -459,7 +459,7 @@ class ReportFailedChallsTest(unittest.TestCase):
auth_handler._report_failed_challs([self.simple_http, self.dvsni_same]) auth_handler._report_failed_challs([self.simple_http, self.dvsni_same])
call_list = mock_zope().add_message.call_args_list call_list = mock_zope().add_message.call_args_list
self.assertTrue(len(call_list) == 1) self.assertTrue(len(call_list) == 1)
self.assertIn("Domains: example.com\n", call_list[0][0][0]) self.assertTrue("Domains: example.com\n" in call_list[0][0][0])
@mock.patch("letsencrypt.auth_handler.zope.component.getUtility") @mock.patch("letsencrypt.auth_handler.zope.component.getUtility")
def test_different_errors_and_domains(self, mock_zope): def test_different_errors_and_domains(self, mock_zope):