Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
install.api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Script
install.api
Commits
f51931ee
Commit
f51931ee
authored
Mar 12, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app列表的url地址修改
parent
53a92a8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
4 deletions
+54
-4
api_test.py
api_test.py
+49
-0
info_service.py
app/info/info_service.py
+5
-4
No files found.
api_test.py
0 → 100644
View file @
f51931ee
# -*- coding:utf-8 -*-
import
json
import
requests
if
__name__
==
'__main__'
:
data
=
{
'user_name'
:
'jkq'
,
'password'
:
'jkq_test'
}
# # 设置登录信息
# requests.post('http://localhost:5000/authorization/',json=data)
# # 登录
# res = requests.post('http://localhost:5000/authorization/login/',json=data)
# print(res.json())
# # 获取项目链接
# res = requests.get('http://localhost:5000/connection/')
# print(res.json())
# json_data = {"project_no": "jkq_test", "db_ip": "47.97.206.38", "db_port": "9610", "db_user": "huansi",
# "db_password": "huansi", "mes_db_name": "HSGmtMes", "tiip_db_name": "HSTIIP",
# "host_ip": "192.168.4.116","id":"1237937496479928320"}
#
# # 设置项目链接
# res = requests.post('http://localhost:5000/connection/', json=json_data)
# print(res.json())
# # 测试项目数据库连接
# res = requests.get('http://localhost:5000/connection/jkq_test/HSGmtMEs/')
# print(res.json())
# json_data = {"project_no": "jkq_test", "server_ip": "jkqjkq.top", "server_ssh_port": "22",
# "server_user": "root",
# "server_password": "Jin1Kai2"}
#
# # 设置远程服务器连接
# res = requests.post('http://localhost:5000/connection/remote_server/', json=json_data)
# print(res.json())
# # 获取远程服务器连接
# res = requests.get('http://localhost:5000/connection/remote_server/')
# print(res.json())
# # 测试端口是否开放
# res = requests.get('http://localhost:5000/connection/test_port/23002/')
# print(res.json())
# # 获取app_list
res
=
requests
.
get
(
'http://localhost:5000/info/app_list/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
app/info/info_service.py
View file @
f51931ee
...
...
@@ -32,10 +32,11 @@ class InfoService(HSBaseUCService):
app_info
=
{}
app_info
[
'app_name'
]
=
container
[
'Names'
][
0
][
1
:]
# "/***"这种格式
logger
.
info
(
'容器{}信息:{}'
.
format
(
app_info
[
'app_name'
],
container
))
port
=
container
[
'Ports'
]
if
port
:
app_info
[
'app_url'
]
=
f
"{host_ip}:{port[0].get('PublicPort')}"
# logger.info('容器{}信息:{}'.format(app_info['app_name'], container))
port_list
=
container
[
'Ports'
]
if
port_list
:
app_url_list
=
[
f
"{host_ip}:{port.get('PublicPort')}"
for
port
in
port_list
if
port
.
get
(
'PublicPort'
)]
app_info
[
'app_url'
]
=
' '
.
join
(
app_url_list
)
else
:
app_info
[
'app_url'
]
=
''
image_name
=
container
[
'Image'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment