From ba93ac487d3f06d193e41873d604814da674097e Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Mon, 23 Mar 2020 15:41:16 +0100 Subject: [PATCH] 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) --- src/pybind/mgr/diskprediction_cloud/module.py | 2 +- src/pybind/mgr/diskprediction_local/module.py | 2 +- src/pybind/mgr/osd_support/module.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/diskprediction_cloud/module.py b/src/pybind/mgr/diskprediction_cloud/module.py index 9edfe9c54802c..50b88e89667ec 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 146c27def8c34..61f3cc1f6dcc7 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 14779d3f324ec..5b743200e003e 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. -- 2.39.5