]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Prevent KeyError when requesting always_on_modules 30426/head
authorVolker Theile <vtheile@suse.com>
Tue, 17 Sep 2019 10:39:22 +0000 (12:39 +0200)
committerVolker Theile <vtheile@suse.com>
Fri, 20 Sep 2019 09:45:47 +0000 (11:45 +0200)
`ceph_release` is not necessarily a valid key for `mgr_map['always_on_modules']`

This PR is inspired by https://github.com/ceph/ceph/pull/30421.

Signed-off-by: Volker Theile <vtheile@suse.com>
src/pybind/mgr/dashboard/controllers/mgr_modules.py

index 6e3cb5a3ee18013853ef8d3e4916dd6c769aaab2..6b8613497103fd1a5303587122f3ad08caae97b1 100644 (file)
@@ -21,7 +21,7 @@ class MgrModules(RESTController):
         """
         result = []
         mgr_map = mgr.get('mgr_map')
-        always_on_modules = mgr_map['always_on_modules'][mgr.release_name]
+        always_on_modules = mgr_map['always_on_modules'].get(mgr.release_name, [])
         for module_config in mgr_map['available_modules']:
             module_name = module_config['name']
             if module_name not in self.ignore_modules: