From 4bed0332c1bec3e4909af5f7354f3530e9dbf023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Palancher?= Date: Wed, 4 Dec 2024 09:08:10 +0100 Subject: [PATCH] fix(agent): fix werkzeug.middleware mod not found In Werkzeug < 0.15, dispatcher was not in a dedicated module. It was included in a big wsgi module before it was splitted. This old version of werkzeug must be fully supported though because it is included in el8. fix #419 --- CHANGELOG.md | 2 ++ slurmweb/apps/agent.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d60a976..18589a5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - docs: Update configuration reference documentation. ### Fixed +- agent: Fix No module named 'werkzeug.middleware' ModuleNotFoundError with + Werkzeug < 0.15 (#419→420). - frontend: Update dependencies to fix CVE-2024-55565 (nanoid). ## [4.0.0] - 2024-11-28 diff --git a/slurmweb/apps/agent.py b/slurmweb/apps/agent.py index cc5bd7f8..bf693a35 100644 --- a/slurmweb/apps/agent.py +++ b/slurmweb/apps/agent.py @@ -10,7 +10,15 @@ from rfl.web.tokens import RFLTokenizedRBACWebApp from racksdb.errors import RacksDBSchemaError, RacksDBFormatError from racksdb.web.app import RacksDBWebBlueprint -from werkzeug.middleware import dispatcher + +try: + from werkzeug.middleware import dispatcher +except ModuleNotFoundError: + # In Werkzeug < 0.15, dispatcher was not in a dedicated module, it was included in a + # big wsgi module. This old version of werkzeug must be fully supported because it + # is included in el8. See https://github.com/rackslab/Slurm-web/issues/419 for + # reference. + from werkzeug import wsgi as dispatcher from . import SlurmwebWebApp from ..version import get_version