mirror of https://github.com/jumpserver/jumpserver
fix: 修复命令存储es失效时, 会话、命令记录列表创建和查看失败的问题
parent
1c8ad40565
commit
df2858470a
|
@ -184,9 +184,14 @@ class CommandStore(object):
|
||||||
return Command.from_multi_dict(source_data)
|
return Command.from_multi_dict(source_data)
|
||||||
|
|
||||||
def count(self, **query):
|
def count(self, **query):
|
||||||
body = self.get_query_body(**query)
|
try:
|
||||||
data = self.es.count(index=self.query_index, doc_type=self.doc_type, body=body)
|
body = self.get_query_body(**query)
|
||||||
return data["count"]
|
data = self.es.count(index=self.query_index, doc_type=self.doc_type, body=body)
|
||||||
|
count = data["count"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('ES count error: {}'.format(e))
|
||||||
|
count = 0
|
||||||
|
return count
|
||||||
|
|
||||||
def __getattr__(self, item):
|
def __getattr__(self, item):
|
||||||
return getattr(self.es, item)
|
return getattr(self.es, item)
|
||||||
|
|
Loading…
Reference in New Issue