From b5e8aaf682a582bdf93935bb0491448b12b74e80 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 5 Mar 2015 16:11:43 -0700 Subject: [PATCH] Support for Raven to send crash report from a frozen state. --- gns3server/crash_report.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index 0a41588a..ac930723 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -16,8 +16,7 @@ # along with this program. If not, see . import raven -import json - +import os import sys import struct import platform @@ -36,6 +35,9 @@ class CrashReport: """ DSN = "sync+https://50af75d8641d4ea7a4ea6b38c7df6cf9:41d54936f8f14e558066262e2ec8bbeb@app.getsentry.com/38482" + if hasattr(sys, "frozen"): + cacert = os.path.join(os.getcwd(), "cacert.pem") + DSN += "?ca_certs={}".format(cacert) _instance = None def __init__(self): @@ -62,12 +64,14 @@ class CrashReport: sys.version_info[1], sys.version_info[2]), "python:bit": struct.calcsize("P") * 8, - "python:encoding": sys.getdefaultencoding() + "python:encoding": sys.getdefaultencoding(), + "python:frozen": "{}".format(hasattr(sys, "frozen")) }) try: - self._client.captureException() + report = self._client.captureException() except Exception as e: - log.error("Can't send crash report to Sentry: %s", e) + log.error("Can't send crash report to Sentry: {}".format(e)) + log.info("Crash report sent with event ID: {}".format(self._client.get_ident(report))) @classmethod def instance(cls):