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
f782c6fc
Commit
f782c6fc
authored
Mar 12, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
..
parent
1f0e4658
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
api_test.py
api_test.py
+11
-11
upgrade_service.py
app/upgrade/upgrade_service.py
+1
-0
db_tools.py
app/utils/db_tools.py
+1
-0
No files found.
api_test.py
View file @
f782c6fc
...
...
@@ -58,19 +58,19 @@ if __name__ == '__main__':
# 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/1238022723059486720/')
#
print(json.dumps(res.json(), indent=4))
# 获取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/1238022723059486720/'
)
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/upgrade/rollback/1238022723059486720/'
)
print
(
json
.
dumps
(
res
.
json
(),
indent
=
4
))
\ No newline at end of file
# # 回滚升级
# res = requests.get('http://localhost:5000/upgrade/rollback/1238022723059486720/')
# print(json.dumps(res.json(), indent=4))
\ No newline at end of file
app/upgrade/upgrade_service.py
View file @
f782c6fc
...
...
@@ -82,6 +82,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
with
db_driver
as
session
:
# 对应的版本信息修改为当前版本
session
.
exec_sql
(
f
'update app_upgrade_log set default_version=1 where id={log_id}'
)
session
.
exec_sql
(
f
'update app_upgrade_log set default_version=0 where id<>{log_id}'
)
return
{
'err'
:
err
,
"out"
:
out
}
# 注意异常情况下的处理
...
...
app/utils/db_tools.py
View file @
f782c6fc
...
...
@@ -92,6 +92,7 @@ class DBDriver:
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
if
exc_val
:
self
.
conn
.
rollback
()
raise
exc_val
else
:
self
.
conn
.
commit
()
self
.
conn
.
close
()
...
...
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