mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] include tracebak into error email
This commit is contained in:
parent
7f8aa4cc75
commit
2d89964bc7
1 changed files with 9 additions and 3 deletions
|
@ -281,12 +281,17 @@ def certificate_renew(auth, domain_list, force=False, no_checks=False, email=Fal
|
|||
logger.success(m18n.n("certmanager_cert_renew_success", domain=domain))
|
||||
|
||||
except Exception as e:
|
||||
import traceback
|
||||
from StringIO import StringIO
|
||||
stack = StringIO()
|
||||
traceback.print_exc(file=stack)
|
||||
logger.error("Certificate renewing for %s failed !", domain)
|
||||
logger.error(stack.getvalue())
|
||||
logger.error(str(e))
|
||||
|
||||
if email:
|
||||
logger.error("Sending email with details to root ...")
|
||||
_email_renewing_failed(domain, e)
|
||||
_email_renewing_failed(domain, e, stack.getvalue())
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
@ -303,7 +308,7 @@ def _install_cron():
|
|||
_set_permissions(cron_job_file, "root", "root", 0755)
|
||||
|
||||
|
||||
def _email_renewing_failed(domain, exception_message):
|
||||
def _email_renewing_failed(domain, exception_message, stack):
|
||||
from_ = "certmanager@%s (Certificate Manager)" % domain
|
||||
to_ = "root"
|
||||
subject_ = "Certificate renewing attempt for %s failed!" % domain
|
||||
|
@ -313,6 +318,7 @@ def _email_renewing_failed(domain, exception_message):
|
|||
At attempt for renewing the certificate for domain %s failed with the following
|
||||
error :
|
||||
|
||||
%s
|
||||
%s
|
||||
|
||||
Here's the tail of /var/log/yunohost/yunohost-cli.log, which might help to
|
||||
|
@ -322,7 +328,7 @@ investigate :
|
|||
|
||||
-- Certificate Manager
|
||||
|
||||
""" % (domain, exception_message, logs)
|
||||
""" % (domain, exception_message, stack, logs)
|
||||
|
||||
message = """
|
||||
From: %s
|
||||
|
|
Loading…
Add table
Reference in a new issue