From: Sage Weil Date: Tue, 19 Jan 2021 22:31:25 +0000 (-0600) Subject: mgr/cephadm: fix host maintenance health check update X-Git-Tag: v16.2.0~232^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8b8d07afd46d8ec4c36618694f9196c31e437a4c;p=ceph.git 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) --- 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()