From 8b8d07afd46d8ec4c36618694f9196c31e437a4c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 19 Jan 2021 16:31:25 -0600 Subject: [PATCH] mgr/cephadm: fix host maintenance health check update We need to update the self.health_checks dict and use that or else we will clobber any other exising checks. Signed-off-by: Sage Weil (cherry picked from commit 315f58bee20154a7e83cb65f301dce4e22f9c9f6) --- src/pybind/mgr/cephadm/module.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index f788f5ee623d..01f5dd48d74c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1286,18 +1286,15 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, in_maintenance = self.inventory.get_host_with_state("maintenance") if not in_maintenance: - self.set_health_checks({ - "HOST_IN_MAINTENANCE": {} - }) + del self.health_checks["HOST_IN_MAINTENANCE"] else: s = "host is" if len(in_maintenance) == 1 else "hosts are" - self.set_health_checks({ - "HOST_IN_MAINTENANCE": { - "severity": "warning", - "summary": f"{len(in_maintenance)} {s} in maintenance mode", - "detail": [f"{h} is in maintenance" for h in in_maintenance], - } - }) + self.health_checks["HOST_IN_MAINTENANCE"] = { + "severity": "warning", + "summary": f"{len(in_maintenance)} {s} in maintenance mode", + "detail": [f"{h} is in maintenance" for h in in_maintenance], + } + self.set_health_checks(self.health_checks) @trivial_completion @host_exists() -- 2.47.3