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
293740e0
Commit
293740e0
authored
Mar 21, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加日志
parent
7e40b36f
Pipeline
#21284
passed with stage
in 41 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
upgrade_service.py
app/upgrade/upgrade_service.py
+5
-0
No files found.
app/upgrade/upgrade_service.py
View file @
293740e0
...
@@ -106,6 +106,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -106,6 +106,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
docker_compose_file_dir
=
os
.
path
.
join
(
back_up_dir
,
upgrade_no
,
'docker-compose.yml'
)
docker_compose_file_dir
=
os
.
path
.
join
(
back_up_dir
,
upgrade_no
,
'docker-compose.yml'
)
logger
.
info
(
f
'备份的compose文件地址:{docker_compose_file_dir}'
)
logger
.
info
(
f
'备份的compose文件地址:{docker_compose_file_dir}'
)
if
not
os
.
path
.
exists
(
docker_compose_file_dir
):
if
not
os
.
path
.
exists
(
docker_compose_file_dir
):
logger
.
info
(
'远程升级失败'
)
raise
HSException
(
f
'未找到{docker_compose_file_dir}'
)
raise
HSException
(
f
'未找到{docker_compose_file_dir}'
)
return
docker_compose_file_dir
return
docker_compose_file_dir
...
@@ -388,6 +389,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -388,6 +389,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
_cmd
=
'docker save {} -o {}/{}'
.
format
(
deploy_image
,
upgrade_no_back_up_dir
,
file_name
)
_cmd
=
'docker save {} -o {}/{}'
.
format
(
deploy_image
,
upgrade_no_back_up_dir
,
file_name
)
result
=
os
.
system
(
_cmd
)
result
=
os
.
system
(
_cmd
)
if
result
!=
0
:
if
result
!=
0
:
logger
.
info
(
'远程升级失败'
)
raise
RuntimeError
(
"{}执行出错"
.
format
(
_cmd
))
raise
RuntimeError
(
"{}执行出错"
.
format
(
_cmd
))
logger
.
info
(
f
'镜像生成完毕,目录为{upgrade_no_back_up_dir}'
)
logger
.
info
(
f
'镜像生成完毕,目录为{upgrade_no_back_up_dir}'
)
...
@@ -420,6 +422,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -420,6 +422,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
if
app_list_str
:
if
app_list_str
:
app_list_str
=
app_list_str
[
0
]
app_list_str
=
app_list_str
[
0
]
else
:
else
:
logger
.
info
(
'远程升级失败'
)
raise
HSException
(
'未能找到app_list'
)
raise
HSException
(
'未能找到app_list'
)
return
app_list_str
return
app_list_str
...
@@ -438,6 +441,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -438,6 +441,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
if
app_list_str
:
if
app_list_str
:
app_list_str
=
app_list_str
[
0
]
app_list_str
=
app_list_str
[
0
]
else
:
else
:
logger
.
info
(
'远程升级失败'
)
raise
HSException
(
'未能找到app_list'
)
raise
HSException
(
'未能找到app_list'
)
# 如果是*,返回所有镜像名
# 如果是*,返回所有镜像名
...
@@ -484,6 +488,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -484,6 +488,7 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
app_info
=
session
.
retrive_sql
(
query_app_sql
)
app_info
=
session
.
retrive_sql
(
query_app_sql
)
if
not
app_info
:
if
not
app_info
:
logger
.
info
(
'远程升级失败'
)
raise
HSException
(
'未找到升级信息'
)
raise
HSException
(
'未找到升级信息'
)
upgrade_no
=
app_info
[
'upgrade_no'
]
upgrade_no
=
app_info
[
'upgrade_no'
]
...
...
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