From: Sage Weil Date: Tue, 21 Jan 2020 16:43:04 +0000 (-0600) Subject: pybind/mgr/*: fix config_notify handling of default values X-Git-Tag: v14.2.10~163^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ebdc3121d0f3ceded8fa2974e0a1950b7226d0c7;p=ceph.git pybind/mgr/*: fix config_notify handling of default values 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. https://tracker.ceph.com/issues/43746 Signed-off-by: Sage Weil (cherry picked from commit 5ace82e65c72847fb875fc01c419937a26a59d70) Conflicts: src/pybind/mgr/cephadm/module.py - nautilus has no "cephadm" module. It does have an "orchestrator_cli" module but it doesn't contain the code being patched src/pybind/mgr/hello/module.py - nautilus has a "hello" module, but it doesn't contain the code being patched --- diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 5962e3018500..2567f7ee2f23 100644 --- a/src/pybind/mgr/alerts/module.py +++ b/src/pybind/mgr/alerts/module.py @@ -105,7 +105,7 @@ class Alerts(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. diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index 3f4ee67986e2..56340dc7f608 100644 --- a/src/pybind/mgr/crash/module.py +++ b/src/pybind/mgr/crash/module.py @@ -53,7 +53,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(' mgr option %s = %s', opt['name'], getattr(self, opt['name'])) diff --git a/src/pybind/mgr/diskprediction_cloud/module.py b/src/pybind/mgr/diskprediction_cloud/module.py index fb918a09102c..503d8a88bc26 100644 --- a/src/pybind/mgr/diskprediction_cloud/module.py +++ b/src/pybind/mgr/diskprediction_cloud/module.py @@ -142,7 +142,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'])) if not self._activated_cloud and self.get_ceph_option('device_failure_prediction_mode') == 'cloud': self._event.set() diff --git a/src/pybind/mgr/diskprediction_local/module.py b/src/pybind/mgr/diskprediction_local/module.py index 191b25cdb468..cb69915f5415 100644 --- a/src/pybind/mgr/diskprediction_local/module.py +++ b/src/pybind/mgr/diskprediction_local/module.py @@ -42,7 +42,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'])) if self.get_ceph_option('device_failure_prediction_mode') == 'local': self._event.set() diff --git a/src/pybind/mgr/k8sevents/module.py b/src/pybind/mgr/k8sevents/module.py index f5f2042fd00f..0c933966da6f 100644 --- a/src/pybind/mgr/k8sevents/module.py +++ b/src/pybind/mgr/k8sevents/module.py @@ -1079,7 +1079,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'])) if not self.kubernetes_control: # Populate the config diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index d2202c98661d..3d5d51759b28 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -113,7 +113,7 @@ class PgAutoscaler(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']))