增加几处错误判断。

pull/105/head
Apex Liu 2017-12-18 13:34:14 +08:00
parent aedea7d3c7
commit ff45dd438d
4 changed files with 12 additions and 8 deletions

View File

@ -2,7 +2,7 @@
[common]
; 'log-file' define the log file location. if not set, default locate
; to $INSTDIR%/log/tpcore.log
; to $INSTDIR%/data/log/tpcore.log
;log-file=/var/log/teleport/tpcore.log
; log-level can be 0 ~ 4, default value is 2.
@ -18,7 +18,7 @@ log-level=2
debug-mode=0
; 'replay-path' define the replay file location. if not set, default locate
; to $INSTDIR%/data/replay/
; to `$INSTDIR%/data/replay`
;replay-path=/var/lib/teleport/replay
; `web-server-rpc` is the rpc interface of web server.
@ -28,9 +28,9 @@ web-server-rpc=http://127.0.0.1:7190/rpc
[rpc]
; Request by web server. `bind-ip` should be the ip of core server. If web server and
; core server running at the same machine, it should be 127.0.0.1.
; core server running at the same machine, it should be `127.0.0.1`.
; DO NOT FORGET update `common::core-server-rpc` in web.ini if you modified this setting.
bind-ip=127.0.0.1
; DO NOT FORGET update `common::core-server-rpc` in web.ini if you modified this setting.
bind-port=52080
[protocol-ssh]

View File

@ -49,12 +49,11 @@ int ts_web_rpc_get_conn_info(int conn_id, TS_CONNECT_INFO& info)
ex_astr body;
if (!ts_http_get(url, body))
{
// EXLOGV("request `get_auth_info` from web return: ");
// EXLOGV(body.c_str());
// EXLOGV("\n");
EXLOGE("[core] get conn info from web-server failed: can not connect to web-server.\n");
return TPE_NETWORK;
}
if (body.length() == 0) {
EXLOGE("[core] get conn info from web-server failed: got nothing.\n");
return TPE_NETWORK;
}

View File

@ -112,11 +112,13 @@ class DoGetSessionIDHandler(TPBaseJsonHandler):
if 'protocol_sub_type' not in args:
return self.write_json(TPE_PARAM)
# 根据auth_id从数据库中取得此授权相关的用户、主机、账号三者详细信息
auth_id = args['auth_id']
protocol_sub_type = int(args['protocol_sub_type'])
ops_auth, err = ops.get_auth(auth_id)
if err != TPE_OK:
return self.write_json(err)
# TODO: 根据auth_id从数据库中取得此授权相关的用户、主机、账号三者详细信息
acc_id = ops_auth['a_id']
host_id = ops_auth['h_id']
user_id = ops_auth['u_id']

View File

@ -556,6 +556,9 @@ def get_remotes(handler, sql_filter, sql_order, sql_limit):
h_ids = [] # 涉及到的主机的ID列表
db_ret = db.query(' '.join(sql))
if db_ret is None:
return TPE_OK, 0, 1, []
for db_item in db_ret:
item = AttrDict()
for i in range(len(_f)):