Unified configuration name

Change-Id: I4fe02164980bb4a03dee023ee262bdf9c94e211d
This commit is contained in:
inspurericzhang 2023-02-28 07:37:21 +00:00
parent 71a1ace424
commit 6b3a21c330
3 changed files with 6 additions and 7 deletions

View File

@ -71,7 +71,7 @@ def upgrade(migrate_engine):
t_mo_custom_config.create(migrate_engine, checkfirst=True)
new_data = {
'id': 'es_index_length',
'id': 'log_save_days',
'value': '30',
'update_time': '1900-01-01 00:00:00'
}

View File

@ -27,7 +27,7 @@ class CustomConfigController(wsgi.Controller):
@wsgi.wrap_check_policy
def get_config(self, req):
result = dict()
result["log_save_days"] = self.config_api.get_config("es_index_length")
result["log_save_days"] = self.config_api.get_config("log_save_days")
return result
@wsgi.wrap_check_policy

View File

@ -42,11 +42,11 @@ class DeleteESIndexTask(object):
return
def delete_es_history_index(self):
len_d = self.config_api.get_config("es_index_length")
len_d = self.config_api.get_config("log_save_days")
if len_d is None:
LOG.error(_LE("es_index_length no exist"))
LOG.error(_LE("the config of log_save_days do not exist"))
return
LOG.info("the elasticsearch indexes keep days {}".format(len_d))
LOG.info("the elasticsearch indexes(log) save days {}".format(len_d))
today = time.strftime('%Y-%m-%d')
try:
indexes_array = self.search_lib.get_all_index()
@ -73,5 +73,4 @@ class DeleteESIndexTask(object):
self.delete_es_history_index()
LOG.info(_LI("delete es index task done"))
except Exception as e:
LOG.error(_LE("delete es index task, catch exception:%s"),
str(e))
LOG.error(_LE("delete es index task, catch exception:%s"), str(e))