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
9cae8bcb
Commit
9cae8bcb
authored
Mar 20, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
远程升级修改成异步处理
parent
e984593d
Pipeline
#21136
passed with stage
in 34 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
35 deletions
+47
-35
upgarde_api.py
app/upgrade/upgarde_api.py
+1
-1
upgrade_service.py
app/upgrade/upgrade_service.py
+46
-34
No files found.
app/upgrade/upgarde_api.py
View file @
9cae8bcb
...
@@ -33,7 +33,7 @@ class UpgradeAPI(ApiController):
...
@@ -33,7 +33,7 @@ class UpgradeAPI(ApiController):
return
UpgradeService
()
.
remote_upgrade
(
log_id
)
return
UpgradeService
()
.
remote_upgrade
(
log_id
)
@
api
(
'remote/step1'
)
@
api
(
'remote/step1'
)
def
get_remote_upgrade
(
self
):
def
get_remote_upgrade
1
(
self
):
'''
'''
远程升级---1
远程升级---1
:return:
:return:
...
...
app/upgrade/upgrade_service.py
View file @
9cae8bcb
# -*- coding:utf-8 -*-
# -*- coding:utf-8 -*-
import
os
import
os
import
re
import
re
from
threading
import
Thread
from
huansi_utils.app.apploader
import
logger
from
huansi_utils.app.apploader
import
logger
from
huansi_utils.exception.exception
import
HSException
from
huansi_utils.exception.exception
import
HSException
...
@@ -108,12 +109,12 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -108,12 +109,12 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
raise
HSException
(
f
'未找到{docker_compose_file_dir}'
)
raise
HSException
(
f
'未找到{docker_compose_file_dir}'
)
return
docker_compose_file_dir
return
docker_compose_file_dir
def
remote_upgrade
(
self
,
log_id
=
None
):
def
_remote_upgrade
(
self
,
log_id
):
'''
from
flask_app
import
global_app
远程升级
with
global_app
.
app_context
():
:return:
from
flask
import
g
'''
g
.
user
=
{}
g
.
language
=
'cn'
upgrade_no
=
self
.
get_upgrade_no_by_log_id
(
log_id
)
upgrade_no
=
self
.
get_upgrade_no_by_log_id
(
log_id
)
self
.
_package_images
(
upgrade_no
)
self
.
_package_images
(
upgrade_no
)
...
@@ -153,9 +154,20 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
...
@@ -153,9 +154,20 @@ docker-compose -f /data/upgrade_tools_data/backup/{upgrade_no}/docker-compose.ym
out
,
err
=
ssh
.
exec_command
(
"sh /huansi/upgrade/load.sh"
)
out
,
err
=
ssh
.
exec_command
(
"sh /huansi/upgrade/load.sh"
)
logger
.
info
(
f
'远程升级信息:{out},远程错误信息:{out}'
)
logger
.
info
(
f
'远程升级信息:{out},远程错误信息:{out}'
)
logger
.
info
(
f
'远程升级完成'
)
return
{
'message'
:
'升级完成'
,
out
:
err
}
return
{
'message'
:
'升级完成'
,
out
:
err
}
def
remote_upgrade
(
self
,
log_id
=
None
):
'''
远程升级
:return:
'''
t
=
Thread
(
target
=
self
.
_remote_upgrade
,
args
=
(
log_id
,))
t
.
start
()
return
{
"message"
:
"开始安装runner"
}
def
remote_upgrade_step1
(
self
):
def
remote_upgrade_step1
(
self
):
'''
'''
远程升级
远程升级
...
...
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