mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
修复更新与重启
This commit is contained in:
@@ -330,11 +330,9 @@ def update_page(request):
|
||||
|
||||
branch = os.getenv('DEV') if os.getenv('DEV') else 'master'
|
||||
local_logs = get_git_log(branch)
|
||||
|
||||
logger.info('本地代码日志{}'.format(local_logs))
|
||||
logger.info('本地代码日志{} \n'.format(local_logs))
|
||||
update_notes = get_git_log('origin/' + branch)
|
||||
|
||||
logger.info('远程代码日志{}'.format(update_notes))
|
||||
logger.info('远程代码日志{} \n'.format(update_notes))
|
||||
if datetime.strptime(
|
||||
update_notes[0].get('date'), '%Y-%m-%d %H:%M:%S') > datetime.strptime(
|
||||
local_logs[0].get('date'), '%Y-%m-%d %H:%M:%S'
|
||||
@@ -390,7 +388,7 @@ def do_update(request):
|
||||
new_requirements_mtime = os.stat('requirements.txt').st_mtime
|
||||
if new_requirements_mtime > requirements_mtime:
|
||||
logger.info('更新环境依赖')
|
||||
result.extend(exec_command(migrate_commands))
|
||||
result.extend(exec_command(requirements_commands))
|
||||
new_pt_site_site = os.stat('pt_site_site.json').st_mtime
|
||||
logger.info('更新前文件最后修改时间')
|
||||
logger.info(pt_site_site_mtime)
|
||||
@@ -432,7 +430,7 @@ def do_restart(request):
|
||||
# 获取docker对象
|
||||
# client = docker.from_env()
|
||||
# 从内部获取容器id
|
||||
cid = socket.gethostname()
|
||||
cid = request.GET.get('cid')
|
||||
# 获取容器对象
|
||||
# container = client.containers.get(cid)
|
||||
# 重启容器
|
||||
|
||||
@@ -187,8 +187,11 @@
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
axios.get(
|
||||
"{% url "do_restart" %}"
|
||||
).then(res => {
|
||||
"{% url "do_restart" %}", {
|
||||
params: {
|
||||
cid: this.cid
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.code === 0) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
@@ -220,11 +223,7 @@
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
axios.get(
|
||||
"{% url "do_update" %}", {
|
||||
params: {
|
||||
cid: this.cid
|
||||
}
|
||||
}
|
||||
"{% url "do_update" %}"
|
||||
).then(res => {
|
||||
if (res.data.code === 0) {
|
||||
console.log(res, 1)
|
||||
|
||||
Reference in New Issue
Block a user