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: v13.0.2~481^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19948%2Fhead;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 --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 430d8b355802..bb9a4c2b8e59 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -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 -