CAPTCHA_TEST_MODE settings and small fix

pull/530/head
xiaokong1937@gmail.com 2017-01-23 12:29:36 +08:00
parent 3f7cb4a458
commit 31bded8953
4 changed files with 12 additions and 12 deletions

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -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)
return "%s %s" % (self.module_name, self.module_args)

View File

@ -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'