From: Sage Weil Date: Tue, 4 Dec 2018 23:28:07 +0000 (-0600) Subject: pybind/mgr: get_config -> get_module_option X-Git-Tag: v14.1.0~641^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b18c6bd13e360d0696289c185e5a3e204e7a5c7d;p=ceph.git pybind/mgr: get_config -> get_module_option Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 77c1459755f4..114778086031 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -297,7 +297,7 @@ class Module(MgrModule): s = { 'plans': list(self.plans.keys()), 'active': self.active, - 'mode': self.get_config('mode', default_mode), + 'mode': self.get_module_option('mode', default_mode), } return (0, json.dumps(s, indent=4), '') elif command['prefix'] == 'balancer mode': @@ -399,14 +399,14 @@ class Module(MgrModule): def serve(self): self.log.info('Starting') while self.run: - self.active = self.get_config('active', '') is not '' - begin_time = self.get_config('begin_time') or '0000' - end_time = self.get_config('end_time') or '2400' + self.active = self.get_module_option('active', '') is not '' + begin_time = self.get_module_option('begin_time') or '0000' + end_time = self.get_module_option('end_time') or '2400' timeofday = time.strftime('%H%M', time.localtime()) self.log.debug('Waking up [%s, scheduled for %s-%s, now %s]', "active" if self.active else "inactive", begin_time, end_time, timeofday) - sleep_interval = float(self.get_config('sleep_interval', + sleep_interval = float(self.get_module_option('sleep_interval', default_sleep_interval)) if self.active and self.time_in_interval(timeofday, begin_time, end_time): self.log.debug('Running') @@ -629,7 +629,7 @@ class Module(MgrModule): self.log.debug('score_by_root %s' % pe.score_by_root) # get the list of score metrics, comma separated - metrics = self.get_config('crush_compat_metrics', 'pgs,objects,bytes').split(',') + metrics = self.get_module_option('crush_compat_metrics', 'pgs,objects,bytes').split(',') # total score is just average of normalized stddevs pe.score = 0.0 @@ -646,7 +646,7 @@ class Module(MgrModule): def optimize(self, plan): self.log.info('Optimize plan %s' % plan.name) - plan.mode = self.get_config('mode', default_mode) + plan.mode = self.get_module_option('mode', default_mode) max_misplaced = float(self.get_option('target_max_misplaced_ratio')) self.log.info('Mode %s, max misplaced %f' % (plan.mode, max_misplaced)) @@ -692,8 +692,8 @@ class Module(MgrModule): def do_upmap(self, plan): self.log.info('do_upmap') - max_iterations = int(self.get_config('upmap_max_iterations', 10)) - max_deviation = float(self.get_config('upmap_max_deviation', .01)) + max_iterations = int(self.get_module_option('upmap_max_iterations', 10)) + max_deviation = float(self.get_module_option('upmap_max_deviation', .01)) ms = plan.initial if len(plan.pools): @@ -725,10 +725,10 @@ class Module(MgrModule): def do_crush_compat(self, plan): self.log.info('do_crush_compat') - max_iterations = int(self.get_config('crush_compat_max_iterations', 25)) + max_iterations = int(self.get_module_option('crush_compat_max_iterations', 25)) if max_iterations < 1: return -errno.EINVAL, '"crush_compat_max_iterations" must be >= 1' - step = float(self.get_config('crush_compat_step', .5)) + step = float(self.get_module_option('crush_compat_step', .5)) if step <= 0 or step >= 1.0: return -errno.EINVAL, '"crush_compat_step" must be in (0, 1)' max_misplaced = float(self.get_option('target_max_misplaced_ratio')) @@ -738,7 +738,7 @@ class Module(MgrModule): osdmap = ms.osdmap crush = osdmap.get_crush() pe = self.calc_eval(ms, plan.pools) - min_score_to_optimize = float(self.get_config('min_score', 0)) + min_score_to_optimize = float(self.get_module_option('min_score', 0)) if pe.score <= min_score_to_optimize: if pe.score == 0: detail = 'Distribution is already perfect' @@ -781,7 +781,7 @@ class Module(MgrModule): return -errno.EOPNOTSUPP, detail # rebalance by pgs, objects, or bytes - metrics = self.get_config('crush_compat_metrics', 'pgs,objects,bytes').split(',') + metrics = self.get_module_option('crush_compat_metrics', 'pgs,objects,bytes').split(',') key = metrics[0] # balancing using the first score metric if key not in ['pgs', 'bytes', 'objects']: self.log.warn("Invalid crush_compat balancing key %s. Using 'pgs'." % key) diff --git a/src/pybind/mgr/dashboard/controllers/docs.py b/src/pybind/mgr/dashboard/controllers/docs.py index 782a14f9abd9..a96f404e0d4a 100644 --- a/src/pybind/mgr/dashboard/controllers/docs.py +++ b/src/pybind/mgr/dashboard/controllers/docs.py @@ -180,7 +180,7 @@ class Docs(BaseController): baseUrl = "/" scheme = 'https' - ssl = strtobool(mgr.get_localized_config('ssl', 'True')) + ssl = strtobool(mgr.get_localized_module_option('ssl', 'True')) if not ssl: scheme = 'http' diff --git a/src/pybind/mgr/dashboard/controllers/saml2.py b/src/pybind/mgr/dashboard/controllers/saml2.py index 0cc553675398..b3f9147234a3 100644 --- a/src/pybind/mgr/dashboard/controllers/saml2.py +++ b/src/pybind/mgr/dashboard/controllers/saml2.py @@ -77,7 +77,7 @@ class Saml2(BaseController): JwtManager.set_user(JwtManager.decode_token(token)) token = token.decode('utf-8') logger.debug("JWT Token: %s", token) - url_prefix = prepare_url_prefix(mgr.get_config('url_prefix', default='')) + url_prefix = prepare_url_prefix(mgr.get_module_option('url_prefix', default='')) raise cherrypy.HTTPRedirect("{}/#/login?access_token={}".format(url_prefix, token)) else: return { @@ -111,5 +111,5 @@ class Saml2(BaseController): # pylint: disable=unused-argument Saml2._check_python_saml() JwtManager.reset_user() - url_prefix = prepare_url_prefix(mgr.get_config('url_prefix', default='')) + url_prefix = prepare_url_prefix(mgr.get_module_option('url_prefix', default='')) raise cherrypy.HTTPRedirect("{}/#/login".format(url_prefix)) diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index c7c9892e8ccf..68e23e678b2d 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -106,13 +106,13 @@ class CherryPyConfig(object): :returns our URI """ - server_addr = self.get_localized_config('server_addr', '::') - ssl = strtobool(self.get_localized_config('ssl', 'True')) + server_addr = self.get_localized_module_option('server_addr', '::') + ssl = strtobool(self.get_localized_module_option('ssl', 'True')) def_server_port = 8443 if not ssl: def_server_port = 8080 - server_port = self.get_localized_config('server_port', def_server_port) + server_port = self.get_localized_module_option('server_port', def_server_port) if server_addr is None: raise ServerConfigException( 'no server_addr configured; ' @@ -155,7 +155,7 @@ class CherryPyConfig(object): self.cert_tmp.flush() # cert_tmp must not be gc'ed cert_fname = self.cert_tmp.name else: - cert_fname = self.get_localized_config('crt_file') + cert_fname = self.get_localized_module_option('crt_file') pkey = self.get_store("key") if pkey is not None: @@ -164,7 +164,7 @@ class CherryPyConfig(object): self.pkey_tmp.flush() # pkey_tmp must not be gc'ed pkey_fname = self.pkey_tmp.name else: - pkey_fname = self.get_localized_config('key_file') + pkey_fname = self.get_localized_module_option('key_file') if not cert_fname or not pkey_fname: raise ServerConfigException('no certificate configured') @@ -179,7 +179,7 @@ class CherryPyConfig(object): cherrypy.config.update(config) - self._url_prefix = prepare_url_prefix(self.get_config('url_prefix', + self._url_prefix = prepare_url_prefix(self.get_module_option('url_prefix', default='')) uri = "{0}://{1}:{2}{3}/".format( @@ -342,7 +342,7 @@ class Module(MgrModule, CherryPyConfig): self.set_config('jwt_token_ttl', str(cmd['seconds'])) return 0, 'JWT token TTL updated', '' elif cmd['prefix'] == 'dashboard get-jwt-token-ttl': - ttl = self.get_config('jwt_token_ttl', JwtManager.JWT_TOKEN_TTL) + ttl = self.get_module_option('jwt_token_ttl', JwtManager.JWT_TOKEN_TTL) return 0, str(ttl), '' elif cmd['prefix'] == 'dashboard create-self-signed-cert': self.create_self_signed_cert() diff --git a/src/pybind/mgr/dashboard/services/access_control.py b/src/pybind/mgr/dashboard/services/access_control.py index 26952b573d74..ba540e3e5c45 100644 --- a/src/pybind/mgr/dashboard/services/access_control.py +++ b/src/pybind/mgr/dashboard/services/access_control.py @@ -314,8 +314,8 @@ class AccessControlDB(object): logger.debug("AC: Checking for previews DB versions") if self.VERSION == 1: # current version # check if there is username/password from previous version - username = mgr.get_config('username', None) - password = mgr.get_config('password', None) + username = mgr.get_module_option('username', None) + password = mgr.get_module_option('password', None) if username and password: logger.debug("AC: Found single user credentials: user=%s", username) diff --git a/src/pybind/mgr/dashboard/services/auth.py b/src/pybind/mgr/dashboard/services/auth.py index 61205a0eca98..e86f57b91931 100644 --- a/src/pybind/mgr/dashboard/services/auth.py +++ b/src/pybind/mgr/dashboard/services/auth.py @@ -41,7 +41,7 @@ class JwtManager(object): def gen_token(cls, username): if not cls._secret: cls.init() - ttl = mgr.get_config('jwt_token_ttl', cls.JWT_TOKEN_TTL) + ttl = mgr.get_module_option('jwt_token_ttl', cls.JWT_TOKEN_TTL) ttl = int(ttl) now = int(time.mktime(time.gmtime())) payload = { diff --git a/src/pybind/mgr/dashboard/services/sso.py b/src/pybind/mgr/dashboard/services/sso.py index f29c3fa512ba..05ced27d7cd2 100644 --- a/src/pybind/mgr/dashboard/services/sso.py +++ b/src/pybind/mgr/dashboard/services/sso.py @@ -221,7 +221,7 @@ def handle_sso_command(cmd): except Exception: return -errno.EINVAL, '', 'Invalid parameter `idp_metadata`.' - url_prefix = prepare_url_prefix(mgr.get_config('url_prefix', default='')) + url_prefix = prepare_url_prefix(mgr.get_module_option('url_prefix', default='')) settings = { 'sp': { 'entityId': '{}{}/auth/saml2/metadata'.format(ceph_dashboard_base_url, url_prefix), diff --git a/src/pybind/mgr/dashboard/settings.py b/src/pybind/mgr/dashboard/settings.py index ccde39ffd311..6dcea6f5f517 100644 --- a/src/pybind/mgr/dashboard/settings.py +++ b/src/pybind/mgr/dashboard/settings.py @@ -49,11 +49,11 @@ class Options(object): class SettingsMeta(type): def __getattr__(cls, attr): default, stype = getattr(Options, attr) - if stype == bool and str(mgr.get_config(attr, + if stype == bool and str(mgr.get_module_option(attr, default)).lower() == 'false': value = False else: - value = stype(mgr.get_config(attr, default)) + value = stype(mgr.get_module_option(attr, default)) return value def __setattr__(cls, attr, value): diff --git a/src/pybind/mgr/deepsea/module.py b/src/pybind/mgr/deepsea/module.py index d94ab86dfe56..4604dcc1cfce 100644 --- a/src/pybind/mgr/deepsea/module.py +++ b/src/pybind/mgr/deepsea/module.py @@ -84,17 +84,17 @@ class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator): return dict((o['name'], o.get('default', None)) for o in self.MODULE_OPTIONS) - def get_config(self, key, default=None): + def get_module_option(self, key, default=None): """ - Overrides the default MgrModule get_config() method to pull in defaults + Overrides the default MgrModule get_module_option() method to pull in defaults specific to this module """ - return super(DeepSeaOrchestrator, self).get_config(key, default=self.config_keys[key]) + return super(DeepSeaOrchestrator, self).get_module_option(key, default=self.config_keys[key]) def _config_valid(self): for key in self.config_keys.keys(): - if not self.get_config(key, self.config_keys[key]): + if not self.get_module_option(key, self.config_keys[key]): return False return True @@ -233,7 +233,7 @@ class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator): def handle_command(self, inbuf, cmd): if cmd['prefix'] == 'deepsea config-show': - return 0, json.dumps(dict([(key, self.get_config(key)) for key in self.config_keys.keys()])), '' + return 0, json.dumps(dict([(key, self.get_module_option(key)) for key in self.config_keys.keys()])), '' elif cmd['prefix'] == 'deepsea config-set': if cmd['key'] not in self.config_keys.keys(): @@ -414,7 +414,7 @@ class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator): """ returns the response, which the caller then has to read """ - url = "{0}/{1}".format(self.get_config('salt_api_url'), path) + url = "{0}/{1}".format(self.get_module_option('salt_api_url'), path) try: if method.lower() == 'get': resp = requests.get(url, headers = { "X-Auth-Token": self._token }, @@ -440,9 +440,9 @@ class DeepSeaOrchestrator(MgrModule, orchestrator.Orchestrator): def _login(self): resp = self._do_request('POST', 'login', data = { - "eauth": self.get_config('salt_api_eauth'), - "sharedsecret" if self.get_config('salt_api_eauth') == 'sharedsecret' else 'password': self.get_config('salt_api_password'), - "username": self.get_config('salt_api_username') + "eauth": self.get_module_option('salt_api_eauth'), + "sharedsecret" if self.get_module_option('salt_api_eauth') == 'sharedsecret' else 'password': self.get_module_option('salt_api_password'), + "username": self.get_module_option('salt_api_username') }) self._token = resp.json()['return'][0]['token'] self.log.info("Salt API login successful") diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 215811a21f6f..e34e54abca21 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -192,7 +192,7 @@ class Module(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_config(opt['name']) or opt['default']) + self.get_module_option(opt['name']) or opt['default']) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) def serve(self): diff --git a/src/pybind/mgr/diskprediction_cloud/module.py b/src/pybind/mgr/diskprediction_cloud/module.py index 583f99b5fe27..cac1d5f80f5b 100644 --- a/src/pybind/mgr/diskprediction_cloud/module.py +++ b/src/pybind/mgr/diskprediction_cloud/module.py @@ -131,7 +131,7 @@ class Module(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_config(opt['name']) or opt['default']) + self.get_module_option(opt['name']) or opt['default']) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) if not self._activated_cloud and self.get_option('device_failure_prediction_mode') == 'cloud': self._event.set() @@ -163,7 +163,7 @@ class Module(MgrModule): return True def get_configuration(self, key): - return self.get_config(key, self.config_keys[key]) + return self.get_module_option(key, self.config_keys[key]) @staticmethod def _convert_timestamp(predicted_timestamp, life_expectancy_day): @@ -235,7 +235,7 @@ class Module(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_config(opt['name']) or opt['default']) + self.get_module_option(opt['name']) or opt['default']) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) def _status(self, cmd): @@ -361,7 +361,7 @@ class Module(MgrModule): def show_module_config(self): for key, default in self.config_keys.items(): - self.set_config_option(key, self.get_config(key, default)) + self.set_config_option(key, self.get_module_option(key, default)) def serve(self): self.log.info('Starting diskprediction module') diff --git a/src/pybind/mgr/diskprediction_local/module.py b/src/pybind/mgr/diskprediction_local/module.py index 17e3fc2cff36..1cdea759e66e 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_config(opt['name']) or opt['default']) + self.get_module_option(opt['name']) or opt['default']) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) if self.get_option('device_failure_prediction_mode') == 'local': self._event.set() @@ -51,7 +51,7 @@ class Module(MgrModule): for opt in self.MODULE_OPTIONS: setattr(self, opt['name'], - self.get_config(opt['name']) or opt['default']) + self.get_module_option(opt['name']) or opt['default']) self.log.debug(' %s = %s', opt['name'], getattr(self, opt['name'])) def handle_command(self, _, cmd): diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index a9db1a263d42..487726329140 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -301,28 +301,28 @@ class Module(MgrModule): def init_module_config(self): self.config['hostname'] = \ - self.get_config("hostname", default=self.config_keys['hostname']) + self.get_module_option("hostname", default=self.config_keys['hostname']) self.config['port'] = \ - int(self.get_config("port", default=self.config_keys['port'])) + int(self.get_module_option("port", default=self.config_keys['port'])) self.config['database'] = \ - self.get_config("database", default=self.config_keys['database']) + self.get_module_option("database", default=self.config_keys['database']) self.config['username'] = \ - self.get_config("username", default=self.config_keys['username']) + self.get_module_option("username", default=self.config_keys['username']) self.config['password'] = \ - self.get_config("password", default=self.config_keys['password']) + self.get_module_option("password", default=self.config_keys['password']) self.config['interval'] = \ - int(self.get_config("interval", + int(self.get_module_option("interval", default=self.config_keys['interval'])) self.config['threads'] = \ - int(self.get_config("threads", + int(self.get_module_option("threads", default=self.config_keys['threads'])) self.config['batch_size'] = \ - int(self.get_config("batch_size", + int(self.get_module_option("batch_size", default=self.config_keys['batch_size'])) - ssl = self.get_config("ssl", default=self.config_keys['ssl']) + ssl = self.get_module_option("ssl", default=self.config_keys['ssl']) self.config['ssl'] = ssl.lower() == 'true' verify_ssl = \ - self.get_config("verify_ssl", default=self.config_keys['verify_ssl']) + self.get_module_option("verify_ssl", default=self.config_keys['verify_ssl']) self.config['verify_ssl'] = verify_ssl.lower() == 'true' def gather_statistics(self): diff --git a/src/pybind/mgr/localpool/module.py b/src/pybind/mgr/localpool/module.py index ca556d68ac9f..d1f16f745152 100644 --- a/src/pybind/mgr/localpool/module.py +++ b/src/pybind/mgr/localpool/module.py @@ -25,12 +25,12 @@ class Module(MgrModule): """ Check pools on each OSDMap change """ - subtree_type = self.get_config('subtree') or 'rack' - failure_domain = self.get_config('failure_domain') or 'host' - pg_num = self.get_config('pg_num') or '128' - num_rep = self.get_config('num_rep') or '3' - min_size = self.get_config('min_size') - prefix = self.get_config('prefix') or 'by-' + subtree_type + '-' + subtree_type = self.get_module_option('subtree') or 'rack' + failure_domain = self.get_module_option('failure_domain') or 'host' + pg_num = self.get_module_option('pg_num') or '128' + num_rep = self.get_module_option('num_rep') or '3' + min_size = self.get_module_option('min_size') + prefix = self.get_module_option('prefix') or 'by-' + subtree_type + '-' osdmap = self.get("osd_map") lpools = [] diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index c71e019bfea4..b1dbe6a1d207 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -232,7 +232,7 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule): def get_mgr_id(self): return self._ceph_get_mgr_id() - def get_config(self, key, default=None): + def get_module_option(self, key, default=None): """ Retrieve the value of a persistent configuration setting @@ -258,10 +258,10 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule): def get_active_uri(self): return self._ceph_get_active_uri() - def get_localized_config(self, key, default=None): - r = self.get_config(self.get_mgr_id() + '/' + key) + def get_localized_module_option(self, key, default=None): + r = self.get_module_option(self.get_mgr_id() + '/' + key) if r is None: - r = self.get_config(key) + r = self.get_module_option(key) if r is None: r = default @@ -695,7 +695,7 @@ class MgrModule(ceph_module.BaseMgrModule): else: return r - def get_config(self, key, default=None): + def get_module_option(self, key, default=None): """ Retrieve the value of a persistent configuration setting @@ -725,7 +725,7 @@ class MgrModule(ceph_module.BaseMgrModule): def _set_localized(self, key, val, setter): return setter(self.get_mgr_id() + '/' + key, val) - def get_localized_config(self, key, default=None): + def get_localized_module_option(self, key, default=None): """ Retrieve localized configuration for this ceph-mgr instance :param str key: diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index a4e3675d7e72..06c77a88da28 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -62,7 +62,7 @@ class OrchestratorCli(MgrModule): ] def _select_orchestrator(self): - o = self.get_config("orchestrator") + o = self.get_module_option("orchestrator") if o is None: raise NoOrchestrator() diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 44ad503d2d1b..6d2b952eb4fd 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -670,10 +670,10 @@ class Module(MgrModule): raise cherrypy.HTTPError(503, 'No MON connection') # Make the cache timeout for collecting configurable - self.collect_timeout = self.get_localized_config('scrape_interval', 5.0) + self.collect_timeout = self.get_localized_module_option('scrape_interval', 5.0) - server_addr = self.get_localized_config('server_addr', DEFAULT_ADDR) - server_port = self.get_localized_config('server_port', DEFAULT_PORT) + server_addr = self.get_localized_module_option('server_addr', DEFAULT_ADDR) + server_port = self.get_localized_module_option('server_port', DEFAULT_PORT) self.log.info( "server_addr: %s server_port: %s" % (server_addr, server_port) @@ -712,8 +712,8 @@ class StandbyModule(MgrStandbyModule): self.shutdown_event = threading.Event() def serve(self): - server_addr = self.get_localized_config('server_addr', '::') - server_port = self.get_localized_config('server_port', DEFAULT_PORT) + server_addr = self.get_localized_module_option('server_addr', '::') + server_port = self.get_localized_module_option('server_port', DEFAULT_PORT) self.log.info("server_addr: %s server_port: %s" % (server_addr, server_port)) cherrypy.config.update({ 'server.socket_host': server_addr, diff --git a/src/pybind/mgr/restful/module.py b/src/pybind/mgr/restful/module.py index 163f428ec162..ac89e427f8c0 100644 --- a/src/pybind/mgr/restful/module.py +++ b/src/pybind/mgr/restful/module.py @@ -279,11 +279,11 @@ class Module(MgrModule): separators=(',', ': '), ) - server_addr = self.get_localized_config('server_addr', '::') + server_addr = self.get_localized_module_option('server_addr', '::') if server_addr is None: raise CannotServe('no server_addr configured; try "ceph config-key set mgr/restful/server_addr "') - server_port = int(self.get_localized_config('server_port', '8003')) + server_port = int(self.get_localized_module_option('server_port', '8003')) self.log.info('server_addr: %s server_port: %d', server_addr, server_port) @@ -303,7 +303,7 @@ class Module(MgrModule): pkey_tmp.flush() pkey_fname = pkey_tmp.name else: - pkey_fname = self.get_localized_config('key_file') + pkey_fname = self.get_localized_module_option('key_file') if not cert_fname or not pkey_fname: raise CannotServe('no certificate configured') diff --git a/src/pybind/mgr/selftest/module.py b/src/pybind/mgr/selftest/module.py index 9635abeac58a..73bcb7bb442d 100644 --- a/src/pybind/mgr/selftest/module.py +++ b/src/pybind/mgr/selftest/module.py @@ -124,9 +124,9 @@ class Module(MgrModule): else: return 0, '', 'No background workload was running' elif command['prefix'] == 'mgr self-test config get': - return 0, str(self.get_config(command['key'])), '' + return 0, str(self.get_module_option(command['key'])), '' elif command['prefix'] == 'mgr self-test config get_localized': - return 0, str(self.get_localized_config(command['key'])), '' + return 0, str(self.get_localized_module_option(command['key'])), '' elif command['prefix'] == 'mgr self-test remote': self._test_remote_calls() return 0, '', 'Successfully called' @@ -255,10 +255,10 @@ class Module(MgrModule): # persisted), it's just for the python interface bit. self.set_config("testkey", "testvalue") - assert self.get_config("testkey") == "testvalue" + assert self.get_module_option("testkey") == "testvalue" self.set_localized_config("testkey", "testvalue") - assert self.get_localized_config("testkey") == "testvalue" + assert self.get_localized_module_option("testkey") == "testvalue" def _self_test_store(self): existing_keys = set(self.get_store_prefix("test").keys()) diff --git a/src/pybind/mgr/telegraf/module.py b/src/pybind/mgr/telegraf/module.py index c0fb653c5887..e6c57c1da6b5 100644 --- a/src/pybind/mgr/telegraf/module.py +++ b/src/pybind/mgr/telegraf/module.py @@ -218,9 +218,9 @@ class Module(MgrModule): def init_module_config(self): self.config['address'] = \ - self.get_config("address", default=self.config_keys['address']) + self.get_module_option("address", default=self.config_keys['address']) self.config['interval'] = \ - int(self.get_config("interval", + int(self.get_module_option("interval", default=self.config_keys['interval'])) def now(self): diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index f648ae821bd9..f2cf4722ad71 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -159,7 +159,7 @@ class Module(MgrModule): def init_module_config(self): for key, default in self.config_keys.items(): - self.set_config_option(key, self.get_config(key, default)) + self.set_config_option(key, self.get_module_option(key, default)) self.last_upload = self.get_store('last_upload', None) if self.last_upload is not None: diff --git a/src/pybind/mgr/zabbix/module.py b/src/pybind/mgr/zabbix/module.py index e9aa2cc12063..06cd7e0de41b 100644 --- a/src/pybind/mgr/zabbix/module.py +++ b/src/pybind/mgr/zabbix/module.py @@ -108,7 +108,7 @@ class Module(MgrModule): self.log.debug('Found Ceph fsid %s', self.fsid) for key, default in self.config_keys.items(): - self.set_config_option(key, self.get_config(key, default)) + self.set_config_option(key, self.get_module_option(key, default)) def set_config_option(self, option, value): if option not in self.config_keys.keys():