]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: KeyError on dashboard reload 31469/head
authorPatrick Seidensal <pseidensal@suse.com>
Thu, 7 Nov 2019 15:57:26 +0000 (15:57 +0000)
committerPatrick Seidensal <pseidensal@suse.com>
Mon, 11 Nov 2019 14:07:58 +0000 (15:07 +0100)
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 <pseidensal@suse.com>
src/pybind/mgr/dashboard/controllers/summary.py

index dc4298b98ebe0301a9aa5e40111c1d55cbc216b0..25374867bc38b9f3fb405996b806acc530b49d45 100644 (file)
@@ -64,9 +64,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):