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
49aaf8d2
Commit
49aaf8d2
authored
Mar 13, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
没有app信息不报错了返回空数组
parent
22924ed6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
66 deletions
+67
-66
api_test.py
api_test.py
+65
-65
info_service.py
app/info/info_service.py
+2
-1
No files found.
api_test.py
View file @
49aaf8d2
...
...
@@ -5,74 +5,74 @@ 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升级信息
#
json_data = [
#
{"app_code": "rabbitMQ", "app_name": "rabbitMQ", "app_image": "47.110.145.204:8084/huansi/mq:latest"},
#
{"app_code": "Redis", "app_name": "Redis", "app_image": "47.110.145.204:8084/huansi/redis:latest"},
#
{"app_code": "Tool", "app_name": "tools工具集", "app_image": "47.110.145.204:8084/huansi/hs_tools:1.1"}]
#
#
res = requests.post('http://localhost:5000/info/app_upgrade/', json=json_data)
#
print(res.json())
#
#
获取app升级日志列表
#
res = requests.get('http://localhost:5000/info/upgrade_log/')
#
print(json.dumps(res.json(), indent=4))
#
#
#
#
获取app单次升级日志明细
#
res = requests.get('http://localhost:5000/info/upgrade_log_dtl/1237995081698545664/')
#
print(json.dumps(res.json(), indent=4))
# 设置登录信息
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"
:
"192.168.4.116"
,
"server_ssh_port"
:
"1111
"
,
"server_user"
:
"root"
,
"server_password"
:
"huansi.net"
,
"id"
:
1237968030966910976
}
# 设置远程服务器连接
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升级信息
json_data
=
[
{
"app_code"
:
"rabbitMQ"
,
"app_name"
:
"rabbitMQ"
,
"app_image"
:
"47.110.145.204:8084/huansi/mq:latest"
},
{
"app_code"
:
"Redis"
,
"app_name"
:
"Redis"
,
"app_image"
:
"47.110.145.204:8084/huansi/redis:latest"
},
{
"app_code"
:
"Tool"
,
"app_name"
:
"tools工具集"
,
"app_image"
:
"47.110.145.204:8084/huansi/hs_tools:1.1"
}]
res
=
requests
.
post
(
'http://localhost:5000/info/app_upgrade/'
,
json
=
json_data
)
print
(
res
.
json
())
# 获取app升级日志列表
res
=
requests
.
get
(
'http://localhost:5000/info/upgrade_log/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
# 获取app单次升级日志明细
res
=
requests
.
get
(
'http://localhost:5000/info/upgrade_log_dtl/1237995081698545664/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
# 安装runner
#
res = requests.get('http://localhost:5000/install/runner/')
#
print(json.dumps(res.json(), indent=4))
res
=
requests
.
get
(
'http://localhost:5000/install/runner/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
#
#
回滚升级
#
res = requests.get('http://localhost:5000/upgrade/rollback/1238022723059486720/')
#
print(json.dumps(res.json(), indent=4))
# 回滚升级
res
=
requests
.
get
(
'http://localhost:5000/upgrade/rollback/1238022723059486720/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
# 远程升级
res
=
requests
.
get
(
'http://localhost:5000/upgrade/remote/'
)
...
...
app/info/info_service.py
View file @
49aaf8d2
...
...
@@ -22,7 +22,8 @@ class InfoService(HSBaseUCService):
def
get_app_list
(
self
):
project_info
=
ConnectionService
()
.
get_project_info
()
if
not
project_info
:
raise
HSException
(
'请先设置项目信息'
)
# raise HSException('请先设置项目信息')
return
[]
host_ip
=
project_info
.
get
(
'host_ip'
)
# host_ip = 'localhost'
...
...
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