mirror of https://github.com/jumpserver/jumpserver
fix: 有无效的 ES 时,创建 Session 失败
parent
a47a9c0345
commit
33952b2333
|
@ -2,9 +2,12 @@ from importlib import import_module
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.functional import LazyObject
|
from django.utils.functional import LazyObject
|
||||||
|
|
||||||
|
from common.utils import get_logger
|
||||||
from .command.serializers import SessionCommandSerializer
|
from .command.serializers import SessionCommandSerializer
|
||||||
|
|
||||||
|
|
||||||
|
logger = get_logger(__file__)
|
||||||
|
|
||||||
TYPE_ENGINE_MAPPING = {
|
TYPE_ENGINE_MAPPING = {
|
||||||
'elasticsearch': 'terminal.backends.command.es',
|
'elasticsearch': 'terminal.backends.command.es',
|
||||||
'es': 'terminal.backends.command.es',
|
'es': 'terminal.backends.command.es',
|
||||||
|
@ -29,6 +32,10 @@ def get_terminal_command_storages():
|
||||||
from ..models import CommandStorage
|
from ..models import CommandStorage
|
||||||
storage_list = {}
|
storage_list = {}
|
||||||
for s in CommandStorage.objects.all():
|
for s in CommandStorage.objects.all():
|
||||||
|
if not s.is_valid():
|
||||||
|
logger.warn(f'Command storage invalid: storage={s}')
|
||||||
|
continue
|
||||||
|
|
||||||
if s.type_server:
|
if s.type_server:
|
||||||
storage = get_command_storage()
|
storage = get_command_storage()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue