]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/mgr_module: add default param for MgrStandbyModule.get_config() 19948/head
authorKefu Chai <kchai@redhat.com>
Mon, 15 Jan 2018 03:49:08 +0000 (11:49 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 22 Jan 2018 08:58:12 +0000 (16:58 +0800)
this matches its counterpart of MgrModule.

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

index 430d8b3558020c2f5567d37cddf074be653eb9b7..bb9a4c2b8e59db768059c9d3c330ffe599e9b2da 100644 (file)
@@ -177,8 +177,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()
@@ -624,4 +636,3 @@ class MgrModule(ceph_module.BaseMgrModule):
         self._rados.connect()
 
         return self._rados
-