]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix dashboard instance ssl certificate functionality 40000/head
authorAvan Thakkar <athakkar@redhat.com>
Tue, 16 Feb 2021 22:25:29 +0000 (03:55 +0530)
committerAvan Thakkar <athakkar@localhost.localdomain>
Wed, 10 Mar 2021 14:05:34 +0000 (19:35 +0530)
Fixes: https://tracker.ceph.com/issues/46542
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
(cherry picked from commit 0a88c62e76f80a4ad9c01a91161b77ac6f073ed4)

src/pybind/mgr/dashboard/module.py
src/pybind/mgr/mgr_module.py

index c389ce9581d1e92a6e0d76a717602414395d1b53..75df998a9293d64d521f5b9f9847aa3d40f84320 100644 (file)
@@ -146,7 +146,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'))
@@ -155,7 +155,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'))
index abe4079b289b3b415002f2fd6985cc731924579d..ac4cbdb4279a100b5562fb10ccf261039802d62b 100644 (file)
@@ -780,6 +780,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) -> str:
         return self._ceph_get_active_uri()