Commit 3c7b0d56 authored by ibuler's avatar ibuler

[Bugfix] 修复按p引起的bug

parent 8d41b814
......@@ -8,6 +8,7 @@ import time
import threading
import logging
import socket
import json
from jms.service import AppService
......@@ -19,7 +20,7 @@ from .tasks import TaskHandler
from .recorder import get_command_recorder_class, get_replay_recorder_class
__version__ = '0.4.0'
__version__ = '0.5.0'
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
logger = logging.getLogger(__file__)
......@@ -95,6 +96,9 @@ class Coco:
def load_extra_conf_from_server(self):
configs = self.service.load_config_from_server()
logger.debug("Loading config from server: {}".format(
json.dumps(configs)
))
self.config.update(configs)
def get_recorder_class(self):
......
......@@ -42,7 +42,7 @@ class InteractiveServer:
if self._search_result:
return self._search_result
else:
return None
return []
@search_result.setter
def search_result(self, value):
......
......@@ -189,6 +189,7 @@ class ESCommandRecorder(CommandRecorder, metaclass=Singleton):
batch_size = 10
timeout = 5
no = 0
default_hosts = ["http://localhost"]
def __init__(self, app):
super().__init__(app)
......@@ -196,7 +197,7 @@ class ESCommandRecorder(CommandRecorder, metaclass=Singleton):
self.stop_evt = threading.Event()
self.push_to_es_async()
self.__class__.no += 1
self.store = ESStore(**app.config["COMMAND_RECORD_OPTIONS"])
self.store = ESStore(app.config["COMMAND_STORAGE"].get("HOSTS", self.default_hosts))
if not self.store.ping():
raise AssertionError("ESCommand storage init error")
......
......@@ -9,7 +9,7 @@ BASE_DIR = os.path.dirname(__file__)
class Config:
"""
Coco config file
Coco config file, coco also load config from server update setting below
"""
# 项目名称, 会用来向Jumpserver注册, 识别而已, 不能重复
# APP_NAME = "localhost"
......@@ -59,6 +59,9 @@ class Config:
# Admin的名字,出问题会提示给用户
# ADMINS = ''
COMMAND_STORAGE = {
"TYPE": "server"
}
config = Config()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment