|
|
@ -1,5 +1,6 @@
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import copy
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
from importlib import import_module
|
|
|
|
from importlib import import_module
|
|
|
@ -77,14 +78,14 @@ class CommandStorage(CommonStorageModelMixin, CommonModelMixin):
|
|
|
|
def config(self):
|
|
|
|
def config(self):
|
|
|
|
config = self.meta
|
|
|
|
config = self.meta
|
|
|
|
config.update({'TYPE': self.type})
|
|
|
|
config.update({'TYPE': self.type})
|
|
|
|
return config
|
|
|
|
return copy.deepcopy(config)
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def valid_config(self):
|
|
|
|
def valid_config(self):
|
|
|
|
config = self.config
|
|
|
|
config = self.config
|
|
|
|
if self.type_es and config.get('INDEX_BY_DATE'):
|
|
|
|
if self.type_es and config.get('INDEX_BY_DATE'):
|
|
|
|
engine_mod = import_module(TYPE_ENGINE_MAPPING[self.type])
|
|
|
|
engine_mod = import_module(TYPE_ENGINE_MAPPING[self.type])
|
|
|
|
store = engine_mod.CommandStore(dict(**config))
|
|
|
|
store = engine_mod.CommandStore(config)
|
|
|
|
store._ensure_index_exists()
|
|
|
|
store._ensure_index_exists()
|
|
|
|
index_prefix = config.get('INDEX') or 'jumpserver'
|
|
|
|
index_prefix = config.get('INDEX') or 'jumpserver'
|
|
|
|
date = local_now_date_display()
|
|
|
|
date = local_now_date_display()
|
|
|
|