From 776063737d6400e543c4ebd736988685b6207382 Mon Sep 17 00:00:00 2001 From: Sunnatillo Date: Thu, 14 Aug 2025 15:55:34 +0300 Subject: [PATCH] mgr/prometheus: Handle empty/invalid JSON from orch get-security-config Signed-off-by: Sunnatillo --- src/pybind/mgr/prometheus/module.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 1b8568dceae..cca90245bbb 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -1834,6 +1834,7 @@ class Module(MgrModule, OrchestratorClientMixin): def configure(self, server_addr: str, server_port: int) -> None: cmd = {'prefix': 'orch get-security-config'} ret, out, _ = self.mon_command(cmd) + if ret == 0 and out is not None: try: security_config = json.loads(out) @@ -1841,8 +1842,11 @@ class Module(MgrModule, OrchestratorClientMixin): self.setup_tls_config(server_addr, server_port) return except Exception as e: - self.log.exception(f'Failed to setup cephadm based secure monitoring stack: {e}\n', - 'Falling back to default configuration') + self.log.exception( + 'Failed to setup cephadm based secure monitoring stack: %s\n' + 'Falling back to default configuration', + e + ) # In any error fallback to plain http mode self.setup_default_config(server_addr, server_port) -- 2.39.5