From 6097166055bd749c78fa6f18985d8e231deea1af Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 30 Jul 2023 17:42:52 +1000 Subject: [PATCH 1/6] Remove import urllib3 and let sentry_sdk import and patch it. Fixes https://github.com/GNS3/gns3-gui/issues/3498 --- gns3server/crash_report.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index 728a033c..ce97b167 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -29,7 +29,6 @@ import struct import platform import locale import distro -import urllib3 from .version import __version__, __version_info__ from .config import Config @@ -89,7 +88,7 @@ class CrashReport: ca_certs=cacert, default_integrations=False, integrations=[sentry_logging]) - except urllib3.exceptions.HTTPError as e: + except Exception as e: log.error("Crash report could not be sent: {}".format(e)) return From 1ced862c08b5a0623d9ae0f320567c9ae9d86c5b Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 30 Jul 2023 17:48:30 +1000 Subject: [PATCH 2/6] Support for Python 3.12 --- .github/workflows/testing.yml | 2 +- setup.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 10347cd3..f7398a5a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-20.04 # Downgrade Ubuntu to 20.04 to fix missing Python 3.6 strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 50f1f276..5ee8f8be 100644 --- a/setup.py +++ b/setup.py @@ -109,6 +109,7 @@ setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", ], ) From 88a1cef21f52a27dacd2df39212b7296c3b819b6 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 30 Jul 2023 17:50:25 +1000 Subject: [PATCH 3/6] Revert "Support for Python 3.12" This reverts commit 1ced862c08b5a0623d9ae0f320567c9ae9d86c5b. --- .github/workflows/testing.yml | 2 +- setup.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f7398a5a..10347cd3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-20.04 # Downgrade Ubuntu to 20.04 to fix missing Python 3.6 strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index 5ee8f8be..50f1f276 100644 --- a/setup.py +++ b/setup.py @@ -109,7 +109,6 @@ setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", ], ) From 658bfb7624c20caa581940b8de53c19dd6987aad Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 2 Aug 2023 15:28:32 +1000 Subject: [PATCH 4/6] Allow connection to ws console over IPv6. Fixes https://github.com/GNS3/gns3-web-ui/issues/1400 --- gns3server/handlers/api/controller/node_handler.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gns3server/handlers/api/controller/node_handler.py b/gns3server/handlers/api/controller/node_handler.py index c9e7c057..900d0400 100644 --- a/gns3server/handlers/api/controller/node_handler.py +++ b/gns3server/handlers/api/controller/node_handler.py @@ -17,6 +17,7 @@ import aiohttp import asyncio +import ipaddress from gns3server.web.route import Route from gns3server.controller import Controller @@ -477,7 +478,16 @@ class NodeHandler: await ws.prepare(request) request.app['websockets'].add(ws) - ws_console_compute_url = "ws://{compute_host}:{compute_port}/v2/compute/projects/{project_id}/{node_type}/nodes/{node_id}/console/ws".format(compute_host=compute.host, + compute_host = compute.host + try: + # handle IPv6 address + ip = ipaddress.ip_address(compute_host) + if isinstance(ip, ipaddress.IPv6Address): + compute_host = '[' + compute_host + ']' + except ValueError: + pass + + ws_console_compute_url = "ws://{compute_host}:{compute_port}/v2/compute/projects/{project_id}/{node_type}/nodes/{node_id}/console/ws".format(compute_host=compute_host, compute_port=compute.port, project_id=project.id, node_type=node.node_type, From af83adfdf648b7341f65279a538b67927e10e16f Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 2 Aug 2023 17:41:51 +1000 Subject: [PATCH 5/6] Add debug message when calculating MD5 checksum --- gns3server/utils/images.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index 2c5ed130..6fb79f35 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -167,6 +167,7 @@ def md5sum(path, stopped_event=None): try: m = hashlib.md5() + log.debug("Calculating MD5 sum of `{}`".format(path)) with open(path, 'rb') as f: while True: if stopped_event is not None and stopped_event.is_set(): From c51d71a4fa152db30db78d85877bb32a03603176 Mon Sep 17 00:00:00 2001 From: grossmj Date: Wed, 2 Aug 2023 17:58:53 +1000 Subject: [PATCH 6/6] Fix version check when installing appliances. Ref https://github.com/GNS3/gns3-gui/issues/3486 --- gns3server/controller/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 33552c6a..f62ea34d 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -251,7 +251,8 @@ class Controller: self._iou_license_settings = controller_settings["iou_license"] previous_version = controller_settings.get("version") - if not previous_version or parse_version(__version__) > parse_version(previous_version): + if not previous_version or \ + parse_version(__version__.split("+")[0]) > parse_version(previous_version.split("+")[0]): self._appliance_manager.install_builtin_appliances() self._appliance_manager.appliances_etag = controller_settings.get("appliances_etag")