From: Nathan Cutler Date: Mon, 23 Mar 2020 14:41:16 +0000 (+0100) Subject: pybind/mgr/*: fix config_notify handling of default values X-Git-Tag: v15.2.1~23^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba93ac487d3f06d193e41873d604814da674097e;p=ceph.git pybind/mgr/*: fix config_notify handling of default values After 5ace82e65c72847fb875fc01c419937a26a59d70 was merged, I found three more instances of the code being patched. The commit message of 5ace82e65c72847fb875fc01c419937a26a59d70 was/is: "The default values are handled by mgr_module.py's _get_module_option(); the or here means that we break any non-true (0, false, none) value and override it with the default." Fixes: 5ace82e65c72847fb875fc01c419937a26a59d70 Fixes: https://tracker.ceph.com/issues/43746 Signed-off-by: Nathan Cutler (cherry picked from commit 30585f44de6147c824ed2df1a477ad17f7b51fff) --- diff --git a/src/pybind/mgr/diskprediction_cloud/module.py b/src/pybind/mgr/diskprediction_cloud/module.py index 9edfe9c54802..50b88e89667e 100644 --- a/src/pybind/mgr/diskprediction_cloud/module.py +++ b/src/pybind/mgr/diskprediction_cloud/module.py @@ -246,7 +246,7 @@ class Module(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_module_option(opt['name']) or opt['default']) + self.get_module_option(opt['name'])) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) def _status(self, cmd): diff --git a/src/pybind/mgr/diskprediction_local/module.py b/src/pybind/mgr/diskprediction_local/module.py index 146c27def8c3..61f3cc1f6dcc 100644 --- a/src/pybind/mgr/diskprediction_local/module.py +++ b/src/pybind/mgr/diskprediction_local/module.py @@ -63,7 +63,7 @@ class Module(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_module_option(opt['name']) or opt['default']) + self.get_module_option(opt['name'])) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) def handle_command(self, _, cmd): diff --git a/src/pybind/mgr/osd_support/module.py b/src/pybind/mgr/osd_support/module.py index 14779d3f324e..5b743200e003 100644 --- a/src/pybind/mgr/osd_support/module.py +++ b/src/pybind/mgr/osd_support/module.py @@ -55,7 +55,7 @@ class OSDSupport(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_module_option(opt['name']) or opt['default']) + self.get_module_option(opt['name'])) self.log.debug(' mgr option %s = %s', opt['name'], getattr(self, opt['name'])) # Do the same for the native options.