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
f80b7eef
Commit
f80b7eef
authored
Mar 20, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取日志支持时间
parent
20726c97
Pipeline
#21253
passed with stage
in 23 seconds
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
info_api.py
app/info/info_api.py
+2
-1
info_service.py
app/info/info_service.py
+10
-2
No files found.
app/info/info_api.py
View file @
f80b7eef
...
...
@@ -50,4 +50,5 @@ class InfoAPI(ApiController):
获取日志信息
:return:
'''
return
InfoService
()
.
get_install_logs
()
\ No newline at end of file
args
=
request
.
args
return
InfoService
()
.
get_install_logs
(
args
)
\ No newline at end of file
app/info/info_service.py
View file @
f80b7eef
# -*- coding:utf-8 -*-
import
datetime
import
os
import
shutil
import
time
...
...
@@ -205,12 +206,19 @@ where A.log_id={log_id}'''
return
page_data
def
get_install_logs
(
self
):
def
get_install_logs
(
self
,
args
):
'''
获取升级日志
:return:
'''
logs
=
docker_client
.
logs
(
'install_api'
,
tail
=
200
)
since_time
=
args
.
get
(
'since_time'
,
None
)
if
isinstance
(
since_time
,
str
):
since_time
=
datetime
.
datetime
.
strptime
(
since_time
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
else
:
since_time
=
None
logs
=
docker_client
.
logs
(
'install_api'
,
tail
=
200
,
since
=
since_time
)
if
isinstance
(
logs
,
bytes
):
logs
=
logs
.
decode
()
return
logs
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