]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/rook: Raise proper exception in `describe_service`
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 13 May 2019 09:46:57 +0000 (11:46 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 21 May 2019 13:08:23 +0000 (15:08 +0200)
`describe_service` is called often and raising
  assertions will pollute the log file with tracebacks.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/rook/module.py

index bf377b83ed51d69a265057fce1b9eff24cb890d7..a2653512099e7ce9a8f548dbdecbd2cd4744e9bb 100644 (file)
@@ -182,10 +182,11 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
             try:
                 c.execute()
             except Exception as e:
-                self.log.exception("Completion {0} threw an exception:".format(
-                    c.message
-                ))
-                c.error = e
+                if not isinstance(e, orchestrator.OrchestratorError):
+                    self.log.exception("Completion {0} threw an exception:".format(
+                        c.message
+                    ))
+                c.exception = e
                 c._complete = True
 
             if not c.is_complete:
@@ -331,7 +332,8 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
     @deferred_read
     def describe_service(self, service_type=None, service_id=None, node_name=None):
 
-        assert service_type in ("mds", "osd", "mgr", "mon", "nfs", None), service_type + " unsupported"
+        if service_type not in ("mds", "osd", "mgr", "mon", "nfs", None):
+            raise orchestrator.OrchestratorValidationError(service_type + " unsupported")
 
         pods = self.rook_cluster.describe_pods(service_type, service_id, node_name)