From 04cc5982d81ff19eab94b3b526a666ceff8ba0df Mon Sep 17 00:00:00 2001 From: Patrick Seidensal Date: Thu, 7 Nov 2019 15:57:26 +0000 Subject: [PATCH] mgr/dashboard: KeyError on dashboard reload When reloading the dashboard using `ceph mgr module disable/enable dashbaord`, the error is thrown shortly after the dashboard module has been reactivated, because `dashboard` is not yet available in `services`. A second attempt works. Fixes: https://tracker.ceph.com/issues/42684 Signed-off-by: Patrick Seidensal (cherry picked from commit 808f0bf5e0adf4abda192758edbccdee3d4113d2) --- src/pybind/mgr/dashboard/controllers/summary.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/summary.py b/src/pybind/mgr/dashboard/controllers/summary.py index 0b2d51e527473..09d69ecfb027e 100644 --- a/src/pybind/mgr/dashboard/controllers/summary.py +++ b/src/pybind/mgr/dashboard/controllers/summary.py @@ -63,9 +63,9 @@ class Summary(BaseController): return result def _get_host(self): - mgr_map = mgr.get('mgr_map') - services = mgr_map['services'] - return services['dashboard'] + # type: () -> str + services = mgr.get('mgr_map')['services'] + return services['dashboard'] if 'dashboard' in services else '' @Endpoint() def __call__(self): -- 2.47.3