From 75c8d578ed106c4584c166d8ccd9153c69667d01 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Thu, 28 Oct 2021 01:00:28 +0530 Subject: [PATCH] mgr/dashboard: improve error handling for gather_facts Fixes: https://tracker.ceph.com/issues/53084 Signed-off-by: Avan Thakkar --- src/pybind/mgr/dashboard/controllers/host.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py index 9d63d0a96ef1f..44ecc26afbeaa 100644 --- a/src/pybind/mgr/dashboard/controllers/host.py +++ b/src/pybind/mgr/dashboard/controllers/host.py @@ -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 " -- 2.39.5