]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/dashboard: use _get_localized_key for composing store key
authorKefu Chai <kchai@redhat.com>
Tue, 19 Jan 2021 17:56:02 +0000 (01:56 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 26 Jan 2021 10:02:24 +0000 (18:02 +0800)
Just for keeping this 'encapsulated', there's _get_localized_key helper
in mgr_module (there's also a set_localized_store but it only deals with
the active manager)

As suggested by Ernesto Puerta <epuertat@redhat.com>

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/dashboard/module.py

index 6c6fe9295b0bf01d736ec6bc2abf99f572861907..c389ce9581d1e92a6e0d76a717602414395d1b53 100644 (file)
@@ -16,7 +16,7 @@ import threading
 import time
 from typing import Optional
 
-from mgr_module import CLIWriteCommand, MgrModule, MgrStandbyModule, Option
+from mgr_module import CLIWriteCommand, MgrModule, MgrStandbyModule, Option, _get_localized_key
 from mgr_util import ServerConfigException, create_self_signed_cert, \
     get_default_addr, verify_tls_files
 
@@ -367,7 +367,7 @@ class Module(MgrModule, CherryPyConfig):
             return -errno.EINVAL, '',\
                 'Please specify the certificate file with "-i" option'
         if mgr_id is not None:
-            self.set_store('{}/crt'.format(mgr_id), inbuf.decode())
+            self.set_store(_get_localized_key(mgr_id, 'crt'), inbuf.decode())
         else:
             self.set_store('crt', inbuf.decode())
         return 0, 'SSL certificate updated', ''
@@ -380,7 +380,7 @@ class Module(MgrModule, CherryPyConfig):
             return -errno.EINVAL, '',\
                 'Please specify the certificate key file with "-i" option'
         if mgr_id is not None:
-            self.set_store('{}/key'.format(mgr_id), inbuf.decode())
+            self.set_store(_get_localized_key(mgr_id, 'key'), inbuf.decode())
         else:
             self.set_store('key', inbuf.decode())
         return 0, 'SSL certificate key updated', ''