From acdd26ab4e30ff5abee1d555c5e45787e3d4f02f Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 17 Jun 2020 14:39:59 +0200 Subject: [PATCH] mgr/tests: _ceph_get_module_option returns proper type now. Signed-off-by: Sebastian Wagner --- src/pybind/mgr/tests/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/tests/__init__.py b/src/pybind/mgr/tests/__init__.py index 7bccfc79970..8c54c79e526 100644 --- a/src/pybind/mgr/tests/__init__.py +++ b/src/pybind/mgr/tests/__init__.py @@ -36,7 +36,17 @@ if 'UNITTEST' in os.environ: } def _ceph_get_module_option(self, module, key, localized_prefix: None): - return self._ceph_get_store(f'{module}/{key}') + val = self._ceph_get_store(f'{module}/{key}') + mo = [o for o in self.MODULE_OPTIONS if o['name'] == key] + if len(mo) == 1 and val is not None: + cls = { + 'str': str, + 'secs': int, + 'bool': lambda s: bool(s) and s != 'false' and s != 'False', + 'int': int, + }[mo[0].get('type', 'str')] + return cls(val) + return val def _ceph_set_module_option(self, module, key, val): return self._ceph_set_store(f'{module}/{key}', val) -- 2.39.5