]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: improve error handling for gather_facts
authorAvan Thakkar <athakkar@redhat.com>
Wed, 27 Oct 2021 19:30:28 +0000 (01:00 +0530)
committerAlfonso Martínez <almartin@redhat.com>
Wed, 3 Nov 2021 13:30:05 +0000 (14:30 +0100)
Fixes: https://tracker.ceph.com/issues/53084
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
(cherry picked from commit 75c8d578ed106c4584c166d8ccd9153c69667d01)

src/pybind/mgr/dashboard/controllers/host.py

index 04ed00242cf9a7021d93cd974939b232e7aa9b90..18931ce342dcef9735f8a1c8186c4794ed17d126 100644 (file)
@@ -288,18 +288,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 "