mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 00:02:14 -04:00
Added account registration message and fixed double output
This commit is contained in:
parent
325f2ae4ad
commit
814ab083bd
3 changed files with 23 additions and 2 deletions
|
|
@ -377,7 +377,7 @@ def main(args=sys.argv[1:]):
|
|||
# Reporter
|
||||
report = reporter.Reporter()
|
||||
zope.component.provideUtility(report)
|
||||
atexit.register(report.print_messages)
|
||||
atexit.register(report.atexit_print_messages)
|
||||
|
||||
# Logging
|
||||
level = -args.verbose_count * 10
|
||||
|
|
|
|||
|
|
@ -99,6 +99,15 @@ class Client(object):
|
|||
raise errors.LetsEncryptClientError("Must agree to TOS")
|
||||
|
||||
self.account.save()
|
||||
reporter = zope.component.getUtility(interfaces.IReporter)
|
||||
reporter.add_message(
|
||||
"Your account credentials have been saved in your Let's Encrypt "
|
||||
"configuration directory at {0}. You should make a secure backup "
|
||||
"of this folder now. This configuration directory will also "
|
||||
"contain certificates and private keys obtained by Let's Encrypt "
|
||||
"so making regular backups of this folder is ideal.".format(
|
||||
self.config.config_dir),
|
||||
reporter.HIGH_PRIORITY, True)
|
||||
|
||||
def obtain_certificate(self, domains, csr=None):
|
||||
"""Obtains a certificate from the ACME server.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
"""Collects and displays information to the user."""
|
||||
import collections
|
||||
import logging
|
||||
import os
|
||||
import Queue
|
||||
import sys
|
||||
import textwrap
|
||||
|
|
@ -46,6 +48,16 @@ class Reporter(object):
|
|||
"""
|
||||
assert self.HIGH_PRIORITY <= priority <= self.LOW_PRIORITY
|
||||
self.messages.put(self._msg_type(priority, msg, on_crash))
|
||||
logging.info("Reporting to user: %s", msg)
|
||||
|
||||
def atexit_print_messages(self, pid=os.getpid()):
|
||||
"""Function to be registered with atexit to print messages.
|
||||
|
||||
:param int pid: Process ID
|
||||
|
||||
"""
|
||||
if pid == os.getpid():
|
||||
self.print_messages()
|
||||
|
||||
def print_messages(self):
|
||||
"""Prints messages to the user and clears the message queue.
|
||||
|
|
@ -59,7 +71,7 @@ class Reporter(object):
|
|||
no_exception = sys.exc_info()[0] is None
|
||||
bold_on = sys.stdout.isatty()
|
||||
if bold_on:
|
||||
sys.stdout.write(self._BOLD)
|
||||
print self._BOLD
|
||||
print 'IMPORTANT NOTES:'
|
||||
wrapper = textwrap.TextWrapper(initial_indent=' - ',
|
||||
subsequent_indent=(' ' * 3))
|
||||
|
|
|
|||
Loading…
Reference in a new issue