]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: improve error handling for gather_facts 43690/head
authorAvan Thakkar <athakkar@redhat.com>
Wed, 27 Oct 2021 19:30:28 +0000 (01:00 +0530)
committerAvan Thakkar <athakkar@redhat.com>
Fri, 29 Oct 2021 09:31:22 +0000 (15:01 +0530)
Fixes: https://tracker.ceph.com/issues/53084
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
src/pybind/mgr/dashboard/controllers/host.py

index 9d63d0a96ef1f09f0e253293980ffeeb72107487..44ecc26afbeaab84673809ab290924e1c35eca7e 100644 (file)
@@ -287,18 +287,17 @@ class Host(RESTController):
         hosts = get_hosts(sources)
         orch = OrchClient.instance()
         if str_to_bool(facts):
-            if orch.available(['get_facts']):
-                try:
+            if orch.available():
+                if not orch.get_missing_features(['get_facts']):
                     hosts_facts = orch.hosts.get_facts()
                     return merge_list_of_dicts_by_key(hosts, hosts_facts, 'hostname')
 
-                except Exception:
-                    raise DashboardException(
-                        code='invalid_orchestrator_backend',  # pragma: no cover
-                        msg="Please enable the cephadm orchestrator backend "
-                        "(try `ceph orch set backend cephadm`)",
-                        component='orchestrator',
-                        http_status_code=400)
+                raise DashboardException(
+                    code='invalid_orchestrator_backend',  # pragma: no cover
+                    msg="Please enable the cephadm orchestrator backend "
+                    "(try `ceph orch set backend cephadm`)",
+                    component='orchestrator',
+                    http_status_code=400)
 
             raise DashboardException(code='orchestrator_status_unavailable',  # pragma: no cover
                                      msg="Please configure and enable the orchestrator if you "