]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr: set_config -> set_module_option
authorSage Weil <sage@redhat.com>
Tue, 4 Dec 2018 23:31:04 +0000 (17:31 -0600)
committerSage Weil <sage@redhat.com>
Mon, 10 Dec 2018 18:12:27 +0000 (12:12 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
13 files changed:
src/pybind/mgr/balancer/module.py
src/pybind/mgr/dashboard/module.py
src/pybind/mgr/dashboard/settings.py
src/pybind/mgr/deepsea/module.py
src/pybind/mgr/devicehealth/module.py
src/pybind/mgr/diskprediction_cloud/module.py
src/pybind/mgr/influx/module.py
src/pybind/mgr/mgr_module.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/selftest/module.py
src/pybind/mgr/telegraf/module.py
src/pybind/mgr/telemetry/module.py
src/pybind/mgr/zabbix/module.py

index 1147780860319fe905e0baa762ba116e3cb8660b..330a4fde28d4b3bfbfd39ada1126ad087cbbf570 100644 (file)
@@ -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, '', '')
index 68e23e678b2dd7aaee9b42cc53c635e271c225ab..c7fb0368a6419c6fbd1a82ac9b8a73f05cea169b 100644 (file)
@@ -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)
index 6dcea6f5f5177986fe3083c5249da9fefe1ad2d6..502181ba3b412e95d6f01c37262d3a87af0ff49d 100644 (file)
@@ -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
index 4604dcc1cfcef99036a0a022dc23a7c714566be9..29ef6ab38d0f18f851fca43785cbacfaa1376540 100644 (file)
@@ -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']), ''
 
index e34e54abca21a1813a02ef152e0b92a7fe98adea..a769f7e99b9bea877edd0187d1072842df2eed32 100644 (file)
@@ -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':
index cac1d5f80f5b049db74b2cad12d75e0f8181e04c..4cbfb4de78744c5b6e91804ee604072d965450c2 100644 (file)
@@ -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'
index 4877263291408eb792fbcbde020c69cb2949b65b..52bc7c410fb0c34d4000a3efcbcc328b9f2c00b1 100644 (file)
@@ -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()
index b1dbe6a1d2074d8eee5ec836302706a6375f1437..7ae94b56b16575ca4a6703c6e2d7cd044c05bb0d 100644 (file)
@@ -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):
         """
index 06c77a88da285c60977176f12cbfae3a3e0cc6cc..d2bbdff87cec0e70bd439c7d155a4cf322c6bb5c 100644 (file)
@@ -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()
 
index 73bcb7bb442da8224bbdcf648b78182460bb9c92..0a5b867d7060c0b88414da664f80820c6bfdb880 100644 (file)
@@ -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):
index e6c57c1da6b57e86d127949640407a2204c4b16d..736cf1f7c4ce2d3de18d9fe2e5cfe420ca2c954d 100644 (file)
@@ -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()
index f2cf4722ad7196065990006e0bdf115f0d1fb55b..32c48c39af489b602b87db805f99fae579fd10ce 100644 (file)
@@ -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()
index 06cd7e0de41b1f7fab9bab3a09727b2bf417d87b..469e7c34bde72b51c93eac4c57006c6deaeaa700 100644 (file)
@@ -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,\