增加几处错误判断。
parent
aedea7d3c7
commit
ff45dd438d
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[common]
|
[common]
|
||||||
; 'log-file' define the log file location. if not set, default locate
|
; '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-file=/var/log/teleport/tpcore.log
|
||||||
|
|
||||||
; log-level can be 0 ~ 4, default value is 2.
|
; log-level can be 0 ~ 4, default value is 2.
|
||||||
|
@ -18,7 +18,7 @@ log-level=2
|
||||||
debug-mode=0
|
debug-mode=0
|
||||||
|
|
||||||
; 'replay-path' define the replay file location. if not set, default locate
|
; '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
|
;replay-path=/var/lib/teleport/replay
|
||||||
|
|
||||||
; `web-server-rpc` is the rpc interface of web server.
|
; `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]
|
[rpc]
|
||||||
; Request by web server. `bind-ip` should be the ip of core server. If web server and
|
; 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
|
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
|
bind-port=52080
|
||||||
|
|
||||||
[protocol-ssh]
|
[protocol-ssh]
|
||||||
|
|
|
@ -49,12 +49,11 @@ int ts_web_rpc_get_conn_info(int conn_id, TS_CONNECT_INFO& info)
|
||||||
ex_astr body;
|
ex_astr body;
|
||||||
if (!ts_http_get(url, body))
|
if (!ts_http_get(url, body))
|
||||||
{
|
{
|
||||||
// EXLOGV("request `get_auth_info` from web return: ");
|
EXLOGE("[core] get conn info from web-server failed: can not connect to web-server.\n");
|
||||||
// EXLOGV(body.c_str());
|
|
||||||
// EXLOGV("\n");
|
|
||||||
return TPE_NETWORK;
|
return TPE_NETWORK;
|
||||||
}
|
}
|
||||||
if (body.length() == 0) {
|
if (body.length() == 0) {
|
||||||
|
EXLOGE("[core] get conn info from web-server failed: got nothing.\n");
|
||||||
return TPE_NETWORK;
|
return TPE_NETWORK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,11 +112,13 @@ class DoGetSessionIDHandler(TPBaseJsonHandler):
|
||||||
if 'protocol_sub_type' not in args:
|
if 'protocol_sub_type' not in args:
|
||||||
return self.write_json(TPE_PARAM)
|
return self.write_json(TPE_PARAM)
|
||||||
|
|
||||||
|
# 根据auth_id从数据库中取得此授权相关的用户、主机、账号三者详细信息
|
||||||
auth_id = args['auth_id']
|
auth_id = args['auth_id']
|
||||||
protocol_sub_type = int(args['protocol_sub_type'])
|
protocol_sub_type = int(args['protocol_sub_type'])
|
||||||
ops_auth, err = ops.get_auth(auth_id)
|
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']
|
acc_id = ops_auth['a_id']
|
||||||
host_id = ops_auth['h_id']
|
host_id = ops_auth['h_id']
|
||||||
user_id = ops_auth['u_id']
|
user_id = ops_auth['u_id']
|
||||||
|
|
|
@ -556,6 +556,9 @@ def get_remotes(handler, sql_filter, sql_order, sql_limit):
|
||||||
h_ids = [] # 涉及到的主机的ID列表
|
h_ids = [] # 涉及到的主机的ID列表
|
||||||
|
|
||||||
db_ret = db.query(' '.join(sql))
|
db_ret = db.query(' '.join(sql))
|
||||||
|
if db_ret is None:
|
||||||
|
return TPE_OK, 0, 1, []
|
||||||
|
|
||||||
for db_item in db_ret:
|
for db_item in db_ret:
|
||||||
item = AttrDict()
|
item = AttrDict()
|
||||||
for i in range(len(_f)):
|
for i in range(len(_f)):
|
||||||
|
|
Loading…
Reference in New Issue