Commit 66312ed4 authored by 金凯强's avatar 金凯强 🎨

受黄总压迫,排序显示端口测试列表

parent d51e9dc5
Pipeline #22349 failed with stage
in 11 seconds
...@@ -169,9 +169,18 @@ where B.default_version=1''' ...@@ -169,9 +169,18 @@ where B.default_version=1'''
return app_list return app_list
def test_port(self, project_no, json_data): def test_port(self, project_no, json_data):
'''
测试端口是否开放
:param project_no:
:param json_data:
:return:
'''
# 受黄总压迫,这里要排序一下
project_info = ConnectionService().get_project_info(project_no) project_info = ConnectionService().get_project_info(project_no)
host_ip = project_info['host_ip'] host_ip = project_info['host_ip']
info_list = [] info_list = []
info_list_success = []
info_list_fail = []
for port_info in json_data: for port_info in json_data:
info_dict = {} info_dict = {}
info_dict['port'] = port_info['port'] info_dict['port'] = port_info['port']
...@@ -179,9 +188,12 @@ where B.default_version=1''' ...@@ -179,9 +188,12 @@ where B.default_version=1'''
try: try:
self.test_connect_port(host_ip, port_info['port']) self.test_connect_port(host_ip, port_info['port'])
info_dict['status'] = '测试通过' info_dict['status'] = '测试通过'
info_list_success.append(info_dict)
except Exception: except Exception:
info_dict['status'] = '测试失败' info_dict['status'] = '测试失败'
info_list.append(info_dict) info_list_fail.append(info_dict)
# info_list.append(info_dict)
info_list = info_list_success + info_list_fail
return info_list return info_list
import timeout_decorator import timeout_decorator
......
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