]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/mgr_module: add default param for MgrStandbyModule.get_config()
authorKefu Chai <kchai@redhat.com>
Mon, 15 Jan 2018 03:49:08 +0000 (11:49 +0800)
committerJohn Spray <john.spray@redhat.com>
Tue, 30 Jan 2018 16:18:48 +0000 (16:18 +0000)
this matches its counterpart of MgrModule.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit bc7de8b124c32a2ee6910a3bac6a06f1c566a2ac)

src/pybind/mgr/mgr_module.py

index 1abbcc5cd4fbe02c4fc635c3586ff6ed393b5972..029319ff9743a88982828c69f34c76b1858e480b 100644 (file)
@@ -174,8 +174,20 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule):
     def get_mgr_id(self):
         return self._ceph_get_mgr_id()
 
-    def get_config(self, key):
-        return self._ceph_get_config(key)
+    def get_config(self, key, default=None):
+        """
+        Retrieve the value of a persistent configuration setting
+
+        :param str key:
+        :param default: the default value of the config if it is not found
+        :return: str
+        """
+        r = self._ceph_get_config(key)
+        if r is None:
+            return default
+        else:
+            return r
+
 
     def get_active_uri(self):
         return self._ceph_get_active_uri()