]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix host maintenance health check update
authorSage Weil <sage@newdream.net>
Tue, 19 Jan 2021 22:31:25 +0000 (16:31 -0600)
committerSage Weil <sage@newdream.net>
Tue, 19 Jan 2021 22:31:25 +0000 (16:31 -0600)
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 <sage@newdream.net>
src/pybind/mgr/cephadm/module.py

index e0e26ce3f4a62e1359e397df7bb04d38933b0eb3..07347f1d26eae1b09b45b33e09fc3b04b9fdfa57 100644 (file)
@@ -1283,18 +1283,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()