mirror of
https://github.com/certbot/certbot.git
synced 2026-08-05 13:02:04 +02:00
Added account registration message and fixed double output
This commit is contained in:
+1
-1
@@ -377,7 +377,7 @@ def main(args=sys.argv[1:]):
|
|||||||
# Reporter
|
# Reporter
|
||||||
report = reporter.Reporter()
|
report = reporter.Reporter()
|
||||||
zope.component.provideUtility(report)
|
zope.component.provideUtility(report)
|
||||||
atexit.register(report.print_messages)
|
atexit.register(report.atexit_print_messages)
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
level = -args.verbose_count * 10
|
level = -args.verbose_count * 10
|
||||||
|
|||||||
@@ -99,6 +99,15 @@ class Client(object):
|
|||||||
raise errors.LetsEncryptClientError("Must agree to TOS")
|
raise errors.LetsEncryptClientError("Must agree to TOS")
|
||||||
|
|
||||||
self.account.save()
|
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):
|
def obtain_certificate(self, domains, csr=None):
|
||||||
"""Obtains a certificate from the ACME server.
|
"""Obtains a certificate from the ACME server.
|
||||||
|
|||||||
+13
-1
@@ -1,5 +1,7 @@
|
|||||||
"""Collects and displays information to the user."""
|
"""Collects and displays information to the user."""
|
||||||
import collections
|
import collections
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
import Queue
|
import Queue
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
@@ -46,6 +48,16 @@ class Reporter(object):
|
|||||||
"""
|
"""
|
||||||
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)
|
||||||
|
|
||||||
|
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):
|
def print_messages(self):
|
||||||
"""Prints messages to the user and clears the message queue.
|
"""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
|
no_exception = sys.exc_info()[0] is None
|
||||||
bold_on = sys.stdout.isatty()
|
bold_on = sys.stdout.isatty()
|
||||||
if bold_on:
|
if bold_on:
|
||||||
sys.stdout.write(self._BOLD)
|
print self._BOLD
|
||||||
print 'IMPORTANT NOTES:'
|
print 'IMPORTANT NOTES:'
|
||||||
wrapper = textwrap.TextWrapper(initial_indent=' - ',
|
wrapper = textwrap.TextWrapper(initial_indent=' - ',
|
||||||
subsequent_indent=(' ' * 3))
|
subsequent_indent=(' ' * 3))
|
||||||
|
|||||||
Reference in New Issue
Block a user