From ba2c6015ebe0d2fd55e38f1a1472810551e8d0c1 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 15 Jan 2018 11:49:08 +0800 Subject: [PATCH] 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) --- src/pybind/mgr/mgr_module.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 1abbcc5cd4fbe..029319ff9743a 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() -- 2.39.5