From 99689a68cc0f24d3075e8bf8bc9afef02159fc85 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 4 Dec 2018 17:31:04 -0600 Subject: [PATCH] pybind/mgr: set_config -> set_module_option Signed-off-by: Sage Weil --- src/pybind/mgr/balancer/module.py | 6 +++--- src/pybind/mgr/dashboard/module.py | 2 +- src/pybind/mgr/dashboard/settings.py | 4 ++-- src/pybind/mgr/deepsea/module.py | 2 +- src/pybind/mgr/devicehealth/module.py | 4 ++-- src/pybind/mgr/diskprediction_cloud/module.py | 14 +++++++------- src/pybind/mgr/influx/module.py | 2 +- src/pybind/mgr/mgr_module.py | 10 +++++----- src/pybind/mgr/orchestrator_cli/module.py | 4 ++-- src/pybind/mgr/selftest/module.py | 4 ++-- src/pybind/mgr/telegraf/module.py | 2 +- src/pybind/mgr/telemetry/module.py | 2 +- src/pybind/mgr/zabbix/module.py | 2 +- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 11477808603..330a4fde28d 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -301,17 +301,17 @@ class Module(MgrModule): } return (0, json.dumps(s, indent=4), '') elif command['prefix'] == 'balancer mode': - self.set_config('mode', command['mode']) + self.set_module_option('mode', command['mode']) return (0, '', '') elif command['prefix'] == 'balancer on': if not self.active: - self.set_config('active', '1') + self.set_module_option('active', '1') self.active = True self.event.set() return (0, '', '') elif command['prefix'] == 'balancer off': if self.active: - self.set_config('active', '') + self.set_module_option('active', '') self.active = False self.event.set() return (0, '', '') diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index 68e23e678b2..c7fb0368a64 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -339,7 +339,7 @@ class Module(MgrModule, CherryPyConfig): if res[0] != -errno.ENOSYS: return res elif cmd['prefix'] == 'dashboard set-jwt-token-ttl': - self.set_config('jwt_token_ttl', str(cmd['seconds'])) + self.set_module_option('jwt_token_ttl', str(cmd['seconds'])) return 0, 'JWT token TTL updated', '' elif cmd['prefix'] == 'dashboard get-jwt-token-ttl': ttl = self.get_module_option('jwt_token_ttl', JwtManager.JWT_TOKEN_TTL) diff --git a/src/pybind/mgr/dashboard/settings.py b/src/pybind/mgr/dashboard/settings.py index 6dcea6f5f51..502181ba3b4 100644 --- a/src/pybind/mgr/dashboard/settings.py +++ b/src/pybind/mgr/dashboard/settings.py @@ -58,13 +58,13 @@ class SettingsMeta(type): def __setattr__(cls, attr, value): if not attr.startswith('_') and hasattr(Options, attr): - mgr.set_config(attr, str(value)) + mgr.set_module_option(attr, str(value)) else: setattr(SettingsMeta, attr, value) def __delattr__(self, attr): if not attr.startswith('_') and hasattr(Options, attr): - mgr.set_config(attr, None) + mgr.set_module_option(attr, None) # pylint: disable=no-init diff --git a/src/pybind/mgr/deepsea/module.py b/src/pybind/mgr/deepsea/module.py index 4604dcc1cfc..29ef6ab38d0 100644 --- a/src/pybind/mgr/deepsea/module.py +++ b/src/pybind/mgr/deepsea/module.py @@ -240,7 +240,7 @@ class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator): return (-errno.EINVAL, '', "Unknown configuration option '{0}'".format(cmd['key'])) - self.set_config(cmd['key'], cmd['value']) + self.set_module_option(cmd['key'], cmd['value']) self._event.set(); return 0, "Configuration option '{0}' updated".format(cmd['key']), '' diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index e34e54abca2..a769f7e99b9 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -158,11 +158,11 @@ class Module(MgrModule): elif cmd['prefix'] == 'device check-health': return self.check_health() elif cmd['prefix'] == 'device monitoring on': - self.set_config('enable_monitoring', 'true') + self.set_module_option('enable_monitoring', 'true') self.event.set() return 0, '', '' elif cmd['prefix'] == 'device monitoring off': - self.set_config('enable_monitoring', 'false') + self.set_module_option('enable_monitoring', 'false') self.set_health_checks({}) # avoid stuck health alerts return 0, '', '' elif cmd['prefix'] == 'device predict-life-expectancy': diff --git a/src/pybind/mgr/diskprediction_cloud/module.py b/src/pybind/mgr/diskprediction_cloud/module.py index cac1d5f80f5..4cbfb4de787 100644 --- a/src/pybind/mgr/diskprediction_cloud/module.py +++ b/src/pybind/mgr/diskprediction_cloud/module.py @@ -157,7 +157,7 @@ class Module(MgrModule): self.log.debug('Setting in-memory config option %s to: %s', option, value) - self.set_config(option, value) + self.set_module_option(option, value) self.config[option] = value return True @@ -183,7 +183,7 @@ class Module(MgrModule): def _set_ssl_target_name(self, cmd): str_ssl_target = cmd.get('ssl_target_name', '') try: - self.set_config('diskprediction_ssl_target_name_override', str_ssl_target) + self.set_module_option('diskprediction_ssl_target_name_override', str_ssl_target) return (0, 'success to config ssl target name', 0) except Exception as e: @@ -192,7 +192,7 @@ class Module(MgrModule): def _set_ssl_default_authority(self, cmd): str_ssl_authority = cmd.get('ssl_authority', '') try: - self.set_config('diskprediction_default_authority', str_ssl_authority) + self.set_module_option('diskprediction_default_authority', str_ssl_authority) return 0, 'success to config ssl default authority', 0 except Exception as e: return -errno.EINVAL, '', str(e) @@ -206,11 +206,11 @@ class Module(MgrModule): 'diskprediction_cert_context', trusted_certs) for _agent in self._agents: _agent.event.set() - self.set_config('diskprediction_server', cmd['server']) - self.set_config('diskprediction_user', cmd['user']) - self.set_config('diskprediction_password', encode_string(cmd['password'])) + self.set_module_option('diskprediction_server', cmd['server']) + self.set_module_option('diskprediction_user', cmd['user']) + self.set_module_option('diskprediction_password', encode_string(cmd['password'])) if cmd.get('port'): - self.set_config('diskprediction_port', cmd['port']) + self.set_module_option('diskprediction_port', cmd['port']) return 0, 'succeed to config cloud mode connection', '' else: return -errno.EINVAL, '', 'certification file not existed' diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index 48772632914..52bc7c410fb 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -444,7 +444,7 @@ class Module(MgrModule): self.log.debug('Setting configuration option %s to %s', key, value) self.set_config_option(key, value) - self.set_config(key, value) + self.set_module_option(key, value) return 0, 'Configuration option {0} updated'.format(key), '' elif cmd['prefix'] == 'influx send': self.send_to_influx() diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index b1dbe6a1d20..7ae94b56b16 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -735,10 +735,10 @@ class MgrModule(ceph_module.BaseMgrModule): self._validate_module_option(key) return self._get_localized(key, default, self._get_module_option) - def _set_config(self, key, val): + def _set_module_option(self, key, val): return self._ceph_set_config(key, val) - def set_config(self, key, val): + def set_module_option(self, key, val): """ Set the value of a persistent configuration setting @@ -746,9 +746,9 @@ class MgrModule(ceph_module.BaseMgrModule): :param str val: """ self._validate_module_option(key) - return self._set_config(key, val) + return self._set_module_option(key, val) - def set_localized_config(self, key, val): + def set_localized_module_option(self, key, val): """ Set localized configuration for this ceph-mgr instance :param str key: @@ -756,7 +756,7 @@ class MgrModule(ceph_module.BaseMgrModule): :return: str """ self._validate_module_option(key) - return self._set_localized(key, val, self._set_config) + return self._set_localized(key, val, self._set_module_option) def set_store(self, key, val): """ diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 06c77a88da2..d2bbdff87ce 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -278,7 +278,7 @@ class OrchestratorCli(MgrModule): module_name = cmd['module'] if module_name == "": - self.set_config("orchestrator", None) + self.set_module_option("orchestrator", None) return HandleCommandResult() for module in mgr_map['available_modules']: @@ -303,7 +303,7 @@ class OrchestratorCli(MgrModule): return HandleCommandResult(-errno.EINVAL, rs="'{0}' is not an orchestrator module".format(module_name)) - self.set_config("orchestrator", module_name) + self.set_module_option("orchestrator", module_name) return HandleCommandResult() diff --git a/src/pybind/mgr/selftest/module.py b/src/pybind/mgr/selftest/module.py index 73bcb7bb442..0a5b867d706 100644 --- a/src/pybind/mgr/selftest/module.py +++ b/src/pybind/mgr/selftest/module.py @@ -254,10 +254,10 @@ class Module(MgrModule): # This is not a strong test (can't tell if values really # persisted), it's just for the python interface bit. - self.set_config("testkey", "testvalue") + self.set_module_option("testkey", "testvalue") assert self.get_module_option("testkey") == "testvalue" - self.set_localized_config("testkey", "testvalue") + self.set_localized_module_option("testkey", "testvalue") assert self.get_localized_module_option("testkey") == "testvalue" def _self_test_store(self): diff --git a/src/pybind/mgr/telegraf/module.py b/src/pybind/mgr/telegraf/module.py index e6c57c1da6b..736cf1f7c4c 100644 --- a/src/pybind/mgr/telegraf/module.py +++ b/src/pybind/mgr/telegraf/module.py @@ -267,7 +267,7 @@ class Module(MgrModule): self.log.debug('Setting configuration option %s to %s', key, value) self.set_config_option(key, value) - self.set_config(key, value) + self.set_module_option(key, value) return 0, 'Configuration option {0} updated'.format(key), '' elif cmd['prefix'] == 'telegraf send': self.send_to_telegraf() diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index f2cf4722ad7..32c48c39af4 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -308,7 +308,7 @@ class Module(MgrModule): self.log.debug('Setting configuration option %s to %s', key, value) self.set_config_option(key, value) - self.set_config(key, value) + self.set_module_option(key, value) return 0, 'Configuration option {0} updated'.format(key), '' elif command['prefix'] == 'telemetry send': self.last_report = self.compile_report() diff --git a/src/pybind/mgr/zabbix/module.py b/src/pybind/mgr/zabbix/module.py index 06cd7e0de41..469e7c34bde 100644 --- a/src/pybind/mgr/zabbix/module.py +++ b/src/pybind/mgr/zabbix/module.py @@ -304,7 +304,7 @@ class Module(MgrModule): self.log.debug('Setting configuration option %s to %s', key, value) if self.set_config_option(key, value): - self.set_config(key, value) + self.set_module_option(key, value) return 0, 'Configuration option {0} updated'.format(key), '' return 1,\ -- 2.39.5