From: Sage Weil Date: Tue, 1 Jan 2019 04:31:18 +0000 (-0600) Subject: Merge PR #25597 into master X-Git-Tag: v14.1.0~532 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=db5a69abd2a0aa0ea54aab87f39543a764ecdc91;p=ceph.git Merge PR #25597 into master * refs/pull/25597/head: mgr/hello: define some module options pybind/mgr/mgr_module: normalize defaults to str when type is missing mgr/telegraf: specify option types mgr/telemetry: specify option types mgr/zabbix: specify option types mgr/localpool: document options and specify in native types mgr/devicehealth: document options and specify in native types mgr/balancer: document and specify options common/options: make runtime vs not runtime explicit, not type-dependent mon/MgrMonitor: mark module options with FLAG_MGR mon/MgrMonitor: make find_module_option handle localized option names pybind/mgr/mgr_module: set values as string mgr: return options as appropriate python type mgr/PythonCompat: python 3 cludges pybind/mgr/mgr_module: make use of defined default value mgr/PyModule: populate ModuleOptions and expose to mon mon/ConfigMonitor: unify module options with built-in options mon/MgrMonitor: populate options mon/MgrMap: define ModuleOptions and include in map common/options: expand type helpers and make them static common/options: pin enums to values Reviewed-by: Tim Serong Reviewed-by: Ernesto Puerta --- db5a69abd2a0aa0ea54aab87f39543a764ecdc91 diff --cc src/mgr/BaseMgrModule.cc index c60b9d922856,d9e7a33ca0e5..31a22665bf68 --- a/src/mgr/BaseMgrModule.cc +++ b/src/mgr/BaseMgrModule.cc @@@ -398,12 -397,9 +398,12 @@@ ceph_get_module_option(BaseMgrModule *s std::string value; bool found = self->py_modules->get_config(self->this_module->get_name(), what, &value); + + PyEval_RestoreThread(tstate); + if (found) { dout(10) << __func__ << " " << what << " found: " << value.c_str() << dendl; - return PyString_FromString(value.c_str()); + return self->this_module->py_module->get_typed_option_value(what, value); } else { dout(4) << __func__ << " " << what << " not found " << dendl; Py_RETURN_NONE; diff --cc src/pybind/mgr/hello/module.py index d56f4653dc81,08d0bf4802ca..e8a3aebbe62c --- a/src/pybind/mgr/hello/module.py +++ b/src/pybind/mgr/hello/module.py @@@ -34,14 -50,14 +50,16 @@@ class Hello(MgrModule) status_code = 0 output_buffer = "Output buffer is for data results" output_string = "Output string is for informative text" - message = "hello world!" - if 'person_name' in cmd: - message = "hello, " + cmd['person_name'] + "!" + message = "Hello, " + cmd['person_name'] + else: + message = "Hello " + self.get_module_option('place'); + if self.get_module_option('emphatic'): + message += '!' - return status_code, output_buffer, message + "\n" + output_string + return HandleCommandResult(retval=status_code, stdout=output_buffer, + stderr=message + "\n" + output_string) + def serve(self): """