From: Avan Thakkar Date: Wed, 27 Oct 2021 19:30:28 +0000 (+0530) Subject: mgr/dashboard: improve error handling for gather_facts X-Git-Tag: v16.2.7~52^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bee105ca88209c0345232b83a30531c937816743;p=ceph.git mgr/dashboard: improve error handling for gather_facts Fixes: https://tracker.ceph.com/issues/53084 Signed-off-by: Avan Thakkar (cherry picked from commit 75c8d578ed106c4584c166d8ccd9153c69667d01) --- diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index 04ed00242cf9..18931ce342dc 100644 --- a/src/pybind/mgr/dashboard/controllers/host.py +++ b/src/pybind/mgr/dashboard/controllers/host.py @@ -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 "