From bc7de8b124c32a2ee6910a3bac6a06f1c566a2ac 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 --- src/pybind/mgr/mgr_module.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 430d8b35580..bb9a4c2b8e5 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 -