From: Kefu Chai Date: Mon, 15 Jan 2018 03:49:08 +0000 (+0800) Subject: pybind/mgr/mgr_module: add default param for MgrStandbyModule.get_config() X-Git-Tag: v12.2.3~105^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba2c6015ebe0d2fd55e38f1a1472810551e8d0c1;p=ceph.git pybind/mgr/mgr_module: add default param for MgrStandbyModule.get_config() this matches its counterpart of MgrModule. Signed-off-by: Kefu Chai (cherry picked from commit bc7de8b124c32a2ee6910a3bac6a06f1c566a2ac) --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 1abbcc5cd4fb..029319ff9743 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -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()