From 5174cb39e6a447e5219b2b4064079ca0181c7750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Palancher?= Date: Tue, 11 Feb 2025 08:58:50 +0100 Subject: [PATCH] slurm-web: add patch for racksdb bearer token bug For reference: https://github.com/rackslab/Slurm-web/issues/471 --- slurm-web/artifact.yml | 4 +- ...-error => 0001-backport-json-decode-error} | 2 +- .../patches/3.2.0/0002-racksdb-bearer-token | 20 ++++++++ .../patches/4.1.0/0001-racksdb-bearer-token | 47 +++++++++++++++++++ 4 files changed, 70 insertions(+), 3 deletions(-) rename slurm-web/patches/3.2.0/{0002-backport-json-decode-error => 0001-backport-json-decode-error} (97%) create mode 100644 slurm-web/patches/3.2.0/0002-racksdb-bearer-token create mode 100644 slurm-web/patches/4.1.0/0001-racksdb-bearer-token diff --git a/slurm-web/artifact.yml b/slurm-web/artifact.yml index 0294bb7..36d286b 100644 --- a/slurm-web/artifact.yml +++ b/slurm-web/artifact.yml @@ -9,6 +9,6 @@ derivatives: main: 4.1.0 slurmweb-3: 3.2.0 rpm: - release: 1 + release: 2 deb: - release: 1 + release: 2 diff --git a/slurm-web/patches/3.2.0/0002-backport-json-decode-error b/slurm-web/patches/3.2.0/0001-backport-json-decode-error similarity index 97% rename from slurm-web/patches/3.2.0/0002-backport-json-decode-error rename to slurm-web/patches/3.2.0/0001-backport-json-decode-error index 09d1111..ea560ab 100644 --- a/slurm-web/patches/3.2.0/0002-backport-json-decode-error +++ b/slurm-web/patches/3.2.0/0001-backport-json-decode-error @@ -8,7 +8,7 @@ Author: Rémi Palancher diff --git a/slurmweb/apps/gateway.py b/slurmweb/apps/gateway.py -index eacf17d..a11331e 100644 +index f7abbf1..6f90eaf 100644 --- a/slurmweb/apps/gateway.py +++ b/slurmweb/apps/gateway.py @@ -5,6 +5,7 @@ diff --git a/slurm-web/patches/3.2.0/0002-racksdb-bearer-token b/slurm-web/patches/3.2.0/0002-racksdb-bearer-token new file mode 100644 index 0000000..13c1046 --- /dev/null +++ b/slurm-web/patches/3.2.0/0002-racksdb-bearer-token @@ -0,0 +1,20 @@ +Description: Send bearer token in headers of RacksDB diagram request, + as required with RFL >= 1.3.0. +Last-Update: 2025-02-10 +Author: Rémi Palancher +Forwarded: https://github.com/rackslab/Slurm-web/issues/471 + + +diff --git a/frontend/src/composables/GatewayAPI.ts b/frontend/src/composables/GatewayAPI.ts +index 2135797..e837dad 100644 +--- a/frontend/src/composables/GatewayAPI.ts ++++ b/frontend/src/composables/GatewayAPI.ts +@@ -532,7 +532,7 @@ export function useGatewayAPI() { + dimensions: { width: width, height: height }, + infrastructure: { equipment_labels: false, ghost_unselected: true } + }, +- false, ++ true, + 'arraybuffer' + ) + // parse multipart response with Response.formData() diff --git a/slurm-web/patches/4.1.0/0001-racksdb-bearer-token b/slurm-web/patches/4.1.0/0001-racksdb-bearer-token new file mode 100644 index 0000000..da3df17 --- /dev/null +++ b/slurm-web/patches/4.1.0/0001-racksdb-bearer-token @@ -0,0 +1,47 @@ +Description: Send bearer token in headers of RacksDB diagram request, + as required with RFL >= 1.3.0. +Last-Update: 2025-02-10 +Author: Rémi Palancher +Forwarded: https://github.com/rackslab/Slurm-web/issues/471 + + +diff --git a/frontend/src/composables/GatewayAPI.ts b/frontend/src/composables/GatewayAPI.ts +index f4780e8..8ed0d2a 100644 +--- a/frontend/src/composables/GatewayAPI.ts ++++ b/frontend/src/composables/GatewayAPI.ts +@@ -456,7 +456,7 @@ export function useGatewayAPI() { + + async function login(idents: loginIdents): Promise { + try { +- return (await restAPI.post('/login', idents)) as GatewayLoginResponse ++ return (await restAPI.post('/login', idents, false)) as GatewayLoginResponse + } catch (error: any) { + /* Translate 401 APIServerError into AuthenticationError */ + if (error instanceof APIServerError && error.status == 401) { +@@ -468,7 +468,7 @@ export function useGatewayAPI() { + + async function anonymousLogin(): Promise { + try { +- return (await restAPI.get('/anonymous')) as GatewayAnonymousLoginResponse ++ return (await restAPI.get('/anonymous', false)) as GatewayAnonymousLoginResponse + } catch (error: any) { + /* Translate 401 APIServerError into AuthenticationError */ + if (error instanceof APIServerError && error.status == 401) { +@@ -479,7 +479,7 @@ export function useGatewayAPI() { + } + + async function message_login(): Promise { +- return await restAPI.get(`/messages/login`) ++ return await restAPI.get('/messages/login', false) + } + + async function clusters(): Promise> { +@@ -567,7 +567,7 @@ export function useGatewayAPI() { + dimensions: { width: width, height: height }, + infrastructure: { equipment_labels: false, ghost_unselected: true } + }, +- false, ++ true, + 'arraybuffer' + ) + // parse multipart response with Response.formData()