From 7ef252087d47111d8a4db4621e8ca7075180cf62 Mon Sep 17 00:00:00 2001 From: Avan Thakkar Date: Wed, 17 Feb 2021 03:55:29 +0530 Subject: [PATCH] mgr/dashboard: fix dashboard instance ssl certificate functionality Fixes: https://tracker.ceph.com/issues/46542 Signed-off-by: Avan Thakkar (cherry picked from commit 0a88c62e76f80a4ad9c01a91161b77ac6f073ed4) Conflicts: src/pybind/mgr/mgr_module.py - Adopting the master branch changes. --- src/pybind/mgr/dashboard/module.py | 4 ++-- src/pybind/mgr/mgr_module.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index 136252e0137..0b0295263d3 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -148,7 +148,7 @@ class CherryPyConfig(object): if use_ssl: # SSL initialization - cert = self.get_store("crt") # type: ignore + cert = self.get_localized_store("crt") # type: ignore if cert is not None: self.cert_tmp = tempfile.NamedTemporaryFile() self.cert_tmp.write(cert.encode('utf-8')) @@ -157,7 +157,7 @@ class CherryPyConfig(object): else: cert_fname = self.get_localized_module_option('crt_file') # type: ignore - pkey = self.get_store("key") # type: ignore + pkey = self.get_localized_store("key") # type: ignore if pkey is not None: self.pkey_tmp = tempfile.NamedTemporaryFile() self.pkey_tmp.write(pkey.encode('utf-8')) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 937cf5c30f8..5a830f7eaab 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -673,6 +673,14 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule, MgrModuleLoggingMixin): """ return self._ceph_get_store(key) + def get_localized_store(self, key: str, default: Optional[str] = None) -> Optional[str]: + r = self._ceph_get_store(_get_localized_key(self.get_mgr_id(), key)) + if r is None: + r = self._ceph_get_store(key) + if r is None: + r = default + return r + def get_active_uri(self): return self._ceph_get_active_uri() -- 2.47.3