From ebdc3121d0f3ceded8fa2974e0a1950b7226d0c7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 21 Jan 2020 10:43:04 -0600 Subject: [PATCH] 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 --- src/pybind/mgr/alerts/module.py | 2 +- src/pybind/mgr/crash/module.py | 2 +- src/pybind/mgr/diskprediction_cloud/module.py | 2 +- src/pybind/mgr/diskprediction_local/module.py | 2 +- src/pybind/mgr/k8sevents/module.py | 2 +- src/pybind/mgr/pg_autoscaler/module.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 5962e301850..2567f7ee2f2 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 3f4ee67986e..56340dc7f60 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 fb918a09102..503d8a88bc2 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 191b25cdb46..cb69915f541 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 f5f2042fd00..0c933966da6 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 d2202c98661..3d5d51759b2 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'])) -- 2.47.3