Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
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
ops
jumpserver
Commits
d3fa3d63
Commit
d3fa3d63
authored
Mar 07, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改Model
parent
5cc43f69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
models.py
apps/terminal/models.py
+2
-2
tasks.py
apps/terminal/tasks.py
+1
-1
No files found.
apps/terminal/models.py
View file @
d3fa3d63
...
...
@@ -127,7 +127,7 @@ class Session(models.Model):
is_finished
=
models
.
BooleanField
(
default
=
False
)
has_replay
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
"Replay"
))
has_command
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
"Command"
))
terminal
=
models
.
ForeignKey
(
Terminal
,
null
=
True
,
on_delete
=
models
.
CASCADE
)
terminal
=
models
.
ForeignKey
(
Terminal
,
null
=
True
,
on_delete
=
models
.
SET_NULL
)
date_last_active
=
models
.
DateTimeField
(
verbose_name
=
_
(
"Date last active"
),
default
=
timezone
.
now
)
date_start
=
models
.
DateTimeField
(
verbose_name
=
_
(
"Date start"
),
db_index
=
True
)
date_end
=
models
.
DateTimeField
(
verbose_name
=
_
(
"Date end"
),
null
=
True
)
...
...
@@ -148,7 +148,7 @@ class Task(models.Model):
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
128
,
choices
=
NAME_CHOICES
,
verbose_name
=
_
(
"Name"
))
args
=
models
.
CharField
(
max_length
=
1024
,
verbose_name
=
_
(
"Args"
))
terminal
=
models
.
ForeignKey
(
Terminal
,
null
=
True
,
on_delete
=
models
.
CASCADE
)
terminal
=
models
.
ForeignKey
(
Terminal
,
null
=
True
,
on_delete
=
models
.
SET_NULL
)
is_finished
=
models
.
BooleanField
(
default
=
False
)
date_created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
date_finished
=
models
.
DateTimeField
(
null
=
True
)
...
...
apps/terminal/tasks.py
View file @
d3fa3d63
...
...
@@ -31,6 +31,6 @@ def delete_terminal_status_period():
def
clean_orphan_session
():
active_sessions
=
Session
.
objects
.
filter
(
is_finished
=
False
)
for
session
in
active_sessions
:
if
not
session
.
terminal
.
is_active
:
if
not
session
.
terminal
or
not
session
.
terminal
.
is_active
:
session
.
is_finished
=
True
session
.
save
()
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