summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/gns3-gui')
-rw-r--r--net-misc/gns3-gui/files/gns3-gui-rmraven.patch182
1 files changed, 0 insertions, 182 deletions
diff --git a/net-misc/gns3-gui/files/gns3-gui-rmraven.patch b/net-misc/gns3-gui/files/gns3-gui-rmraven.patch
deleted file mode 100644
index 9a8be4e62495..000000000000
--- a/net-misc/gns3-gui/files/gns3-gui-rmraven.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-From 2ea1946c0f83672f5289edcce207a8d2de03cc43 Mon Sep 17 00:00:00 2001
-From: grossmj <grossmj@gns3.net>
-Date: Tue, 19 May 2020 15:48:53 +0930
-Subject: [PATCH] Replace Raven by Sentry SDK. Fixes
- https://github.com/GNS3/gns3-server/issues/1758
-
----
- gns3/crash_report.py | 111 +++++++++++++++++++++++++------------------
- requirements.txt | 2 +-
- 2 files changed, 66 insertions(+), 47 deletions(-)
-
-diff --git a/gns3/crash_report.py b/gns3/crash_report.py
-index a6a555fd5..dfbb9fc46 100644
---- a/gns3/crash_report.py
-+++ b/gns3/crash_report.py
-@@ -23,12 +23,11 @@
- import distro
-
- try:
-- import raven
-- from raven.transport.http import HTTPTransport
-- RAVEN_AVAILABLE = True
-+ import sentry_sdk
-+ SENTRY_SDK_AVAILABLE = True
- except ImportError:
-- # raven is not installed with deb package in order to simplify packaging
-- RAVEN_AVAILABLE = False
-+ # Sentry SDK is not installed with deb package in order to simplify packaging
-+ SENTRY_SDK_AVAILABLE = False
-
- from .utils.get_resource import get_resource
- from .version import __version__, __version_info__
-@@ -69,49 +68,50 @@ def __init__(self):
- sentry_uncaught = logging.getLogger('sentry.errors.uncaught')
- sentry_uncaught.disabled = True
-
-- def captureException(self, exception, value, tb):
-- from .local_server import LocalServer
-- from .local_config import LocalConfig
-- from .controller import Controller
-- from .compute_manager import ComputeManager
--
-- local_server = LocalServer.instance().localServerSettings()
-- if local_server["report_errors"]:
-- if not RAVEN_AVAILABLE:
-- return
--
-- if os.path.exists(LocalConfig.instance().runAsRootPath()):
-- log.warning("User has run application as root. Crash reports are disabled.")
-- sys.exit(1)
-- return
-+ if SENTRY_SDK_AVAILABLE:
-+ cacert = None
-+ if hasattr(sys, "frozen"):
-+ cacert_resource = get_resource("cacert.pem")
-+ if cacert_resource is not None and os.path.isfile(cacert_resource):
-+ cacert = cacert_resource
-+ else:
-+ log.error("The SSL certificate bundle file '{}' could not be found".format(cacert_resource))
-
-- if os.path.exists(".git"):
-- log.warning("A .git directory exist crash report is turn off for developers. Instant exit")
-- sys.exit(1)
-- return
-+ sentry_sdk.init(dsn=CrashReport.DSN,
-+ release=__version__,
-+ ca_certs=cacert)
-
-- if hasattr(exception, "fingerprint"):
-- client = raven.Client(CrashReport.DSN, release=__version__, fingerprint=['{{ default }}', exception.fingerprint], transport=HTTPTransport)
-- else:
-- client = raven.Client(CrashReport.DSN, release=__version__, transport=HTTPTransport)
-- context = {
-+ tags = {
- "os:name": platform.system(),
- "os:release": platform.release(),
- "os:win_32": " ".join(platform.win32_ver()),
- "os:mac": "{} {}".format(platform.mac_ver()[0], platform.mac_ver()[2]),
- "os:linux": " ".join(distro.linux_distribution()),
-+
-+ }
-+
-+ self._add_qt_information(tags)
-+
-+ with sentry_sdk.configure_scope() as scope:
-+ for key, value in tags.items():
-+ scope.set_tag(key, value)
-+
-+ extra_context = {
- "python:version": "{}.{}.{}".format(sys.version_info[0],
- sys.version_info[1],
- sys.version_info[2]),
- "python:bit": struct.calcsize("P") * 8,
- "python:encoding": sys.getdefaultencoding(),
-- "python:frozen": "{}".format(hasattr(sys, "frozen")),
-+ "python:frozen": "{}".format(hasattr(sys, "frozen"))
- }
-
- # extra controller and compute information
-- extra_context = {"controller:version": Controller.instance().version(),
-- "controller:host": Controller.instance().host(),
-- "controller:connected": Controller.instance().connected()}
-+ from .controller import Controller
-+ from .compute_manager import ComputeManager
-+ extra_context["controller:version"] = Controller.instance().version()
-+ extra_context["controller:host"] = Controller.instance().host()
-+ extra_context["controller:connected"] = Controller.instance().connected()
-+
- for index, compute in enumerate(ComputeManager.instance().computes()):
- extra_context["compute{}:id".format(index)] = compute.id()
- extra_context["compute{}:name".format(index)] = compute.name(),
-@@ -120,27 +120,46 @@ def captureException(self, exception, value, tb):
- extra_context["compute{}:platform".format(index)] = compute.capabilities().get("platform")
- extra_context["compute{}:version".format(index)] = compute.capabilities().get("version")
-
-- context = self._add_qt_information(context)
-- client.tags_context(context)
-- client.extra_context(extra_context)
-+ with sentry_sdk.configure_scope() as scope:
-+ for key, value in extra_context.items():
-+ scope.set_extra(key, value)
-+
-+ def captureException(self, exception, value, tb):
-+ from .local_server import LocalServer
-+ from .local_config import LocalConfig
-+
-+ local_server = LocalServer.instance().localServerSettings()
-+ if local_server["report_errors"]:
-+ if not SENTRY_SDK_AVAILABLE:
-+ return
-+
-+ if os.path.exists(LocalConfig.instance().runAsRootPath()):
-+ log.warning("User is running application as root. Crash reports disabled.")
-+ sys.exit(1)
-+ return
-+
-+ if os.path.exists(".git"):
-+ log.warning("A .git directory exists, crash reporting is turned off for developers.")
-+ sys.exit(1)
-+ return
-+
- try:
-- report = client.captureException((exception, value, tb))
-+ sentry_sdk.capture_exception((exception, value, tb))
-+ log.info("Crash report sent with event ID: {}".format(sentry_sdk.last_event_id()))
- except Exception as e:
- log.error("Can't send crash report to Sentry: {}".format(e))
-- return
-- log.debug("Crash report sent with event ID: {}".format(client.get_ident(report)))
-
-- def _add_qt_information(self, context):
-+ def _add_qt_information(self, tags):
-+
- try:
- from .qt import QtCore
- from .qt import sip
- except ImportError:
-- return context
-- context["psutil:version"] = psutil.__version__
-- context["pyqt:version"] = QtCore.PYQT_VERSION_STR
-- context["qt:version"] = QtCore.QT_VERSION_STR
-- context["sip:version"] = sip.SIP_VERSION_STR
-- return context
-+ return tags
-+ tags["pyqt:version"] = QtCore.PYQT_VERSION_STR
-+ tags["qt:version"] = QtCore.QT_VERSION_STR
-+ tags["sip:version"] = sip.SIP_VERSION_STR
-+ return tags
-
- @classmethod
- def instance(cls):
-diff --git a/requirements.txt b/requirements.txt
-index 99e803f1b..abd6cc7c9 100644
---- a/requirements.txt
-+++ b/requirements.txt
-@@ -1,5 +1,5 @@
- jsonschema==3.2.0; python_version >= '3.8' # pyup: ignore
- jsonschema==2.6.0; python_version < '3.8' # pyup: ignore
--raven>=5.23.0
-+sentry-sdk>=0.14.4
- psutil==5.6.6
- distro>=1.3.0