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
31bded89
Commit
31bded89
authored
Jan 23, 2017
by
xiaokong1937@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CAPTCHA_TEST_MODE settings and small fix
parent
3f7cb4a4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
12 deletions
+11
-12
fake.json
apps/fixtures/fake.json
+0
-0
settings.py
apps/jumpserver/settings.py
+6
-7
task.py
apps/ops/models/task.py
+3
-4
config_example.py
config_example.py
+2
-1
No files found.
apps/fixtures/fake.json
View file @
31bded89
This diff is collapsed.
Click to expand it.
apps/jumpserver/settings.py
View file @
31bded89
...
...
@@ -14,7 +14,6 @@ import os
import
sys
from
django.urls
import
reverse_lazy
from
datetime
import
timedelta
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
...
...
@@ -299,11 +298,11 @@ CELERY_RESULT_BACKEND = BROKER_URL
# crontab job
# CELERYBEAT_SCHEDULE = {
# Check applications is alive every 10m
# 'check_terminal_alive': {
# 'task': 'applications.tasks.check_terminal_alive',
# 'schedule': timedelta(seconds=TERMINAL_HEATBEAT_INTERVAL),
# 'args': (),
# },
# 'check_terminal_alive': {
# 'task': 'applications.tasks.check_terminal_alive',
# 'schedule': timedelta(seconds=TERMINAL_HEATBEAT_INTERVAL),
# 'args': (),
# },
# }
...
...
@@ -322,4 +321,4 @@ CACHES = {
# Captcha settings, more see https://django-simple-captcha.readthedocs.io/en/latest/advanced.html
CAPTCHA_IMAGE_SIZE
=
(
75
,
33
)
CAPTCHA_FOREGROUND_COLOR
=
'#001100'
CAPTCHA_TEST_MODE
=
CONFIG
.
CAPTCHA_TEST_MODE
apps/ops/models/task.py
View file @
31bded89
...
...
@@ -6,7 +6,6 @@ import logging
from
uuid
import
uuid4
from
assets.models
import
Asset
from
ops.models
import
TaskRecord
from
ops.utils.ansible_api
import
ADHocRunner
,
Config
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
...
...
@@ -20,7 +19,7 @@ logger = logging.getLogger(__name__)
class
Task
(
models
.
Model
):
record
=
models
.
OneToOneField
(
TaskRecord
)
name
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
'Name'
))
is_gather_facts
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
'Is Gather Ansible Facts'
))
is_gather_facts
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
'Is Gather Ansible Facts'
))
assets
=
models
.
ManyToManyField
(
Asset
,
related_name
=
'tasks'
)
def
__unicode__
(
self
):
...
...
@@ -31,6 +30,7 @@ class Task(models.Model):
return
[]
def
run
(
self
):
from
ops.utils.ansible_api
import
ADHocRunner
,
Config
conf
=
Config
()
gather_facts
=
"yes"
if
self
.
is_gather_facts
else
"no"
play_source
=
{
...
...
@@ -55,4 +55,4 @@ class SubTask(models.Model):
register
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
'Ansible Task Register'
))
def
__unicode__
(
self
):
return
"
%
s
%
s"
%
(
self
.
module_name
,
self
.
module_args
)
\ No newline at end of file
return
"
%
s
%
s"
%
(
self
.
module_name
,
self
.
module_args
)
config_example.py
View file @
31bded89
...
...
@@ -81,6 +81,8 @@ class Config:
# EMAIL_USE_TLS = False # If port is 587, set True
# EMAIL_SUBJECT_PREFIX = '[Jumpserver] '
CAPTCHA_TEST_MODE
=
False
def
__init__
(
self
):
pass
...
...
@@ -121,4 +123,3 @@ config = {
}
env
=
'development'
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