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
32fd9bb4
Commit
32fd9bb4
authored
Dec 07, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'new_api' into ops
parents
2b3551f1
15f6d5c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
tasks.py
apps/terminal/tasks.py
+7
-0
clean_migrations.sh
utils/clean_migrations.sh
+7
-2
No files found.
apps/terminal/tasks.py
View file @
32fd9bb4
...
@@ -5,10 +5,12 @@ import time
...
@@ -5,10 +5,12 @@ import time
from
celery
import
shared_task
from
celery
import
shared_task
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.db.utils
import
ProgrammingError
from
.models
import
Session
from
.models
import
Session
ASSETS_CACHE_KEY
=
"terminal__session__assets"
ASSETS_CACHE_KEY
=
"terminal__session__assets"
USERS_CACHE_KEY
=
"terminal__session__users"
USERS_CACHE_KEY
=
"terminal__session__users"
SYSTEM_USER_CACHE_KEY
=
"terminal__session__system_users"
SYSTEM_USER_CACHE_KEY
=
"terminal__session__system_users"
...
@@ -36,6 +38,7 @@ def get_session_system_user_list():
...
@@ -36,6 +38,7 @@ def get_session_system_user_list():
def
set_cache
():
def
set_cache
():
while
True
:
while
True
:
try
:
assets
=
get_session_asset_list
()
assets
=
get_session_asset_list
()
users
=
get_session_user_list
()
users
=
get_session_user_list
()
system_users
=
get_session_system_user_list
()
system_users
=
get_session_system_user_list
()
...
@@ -43,6 +46,9 @@ def set_cache():
...
@@ -43,6 +46,9 @@ def set_cache():
cache
.
set
(
ASSETS_CACHE_KEY
,
assets
)
cache
.
set
(
ASSETS_CACHE_KEY
,
assets
)
cache
.
set
(
USERS_CACHE_KEY
,
users
)
cache
.
set
(
USERS_CACHE_KEY
,
users
)
cache
.
set
(
SYSTEM_USER_CACHE_KEY
,
system_users
)
cache
.
set
(
SYSTEM_USER_CACHE_KEY
,
system_users
)
except
ProgrammingError
:
pass
finally
:
time
.
sleep
(
10
)
time
.
sleep
(
10
)
...
@@ -59,4 +65,5 @@ def main():
...
@@ -59,4 +65,5 @@ def main():
t
.
start
()
t
.
start
()
RUNNING
=
True
RUNNING
=
True
# Todo: 不能migrations了
main
()
main
()
utils/clean_migrations.sh
View file @
32fd9bb4
#!/bin/bash
#!/bin/bash
#
#
for
app
in
users
assets perms audits ops applications
;
do
cd
../apps
rm
-f
../apps/
$app
/migrations/00
*
for
d
in
$(
ls
)
;
do
if
[
-d
$d
]
&&
[
-d
$d
/migrations
]
;
then
rm
-f
$d
/migrations/00
*
fi
done
done
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