From 2e4e5503ccdef908d5a1c10d1ec1d5aec2f6c603 Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 7 Nov 2018 11:26:39 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?common=20settings=E6=97=B6=E6=95=B0=E6=8D=AE=E5=BA=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils.py | 10 ++++++++-- apps/terminal/backends/__init__.py | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/common/utils.py b/apps/common/utils.py index 5b870c088..7daa449a4 100644 --- a/apps/common/utils.py +++ b/apps/common/utils.py @@ -392,7 +392,10 @@ def get_command_storage_or_create_default_storage(): from common.models import common_settings, Setting name = 'TERMINAL_COMMAND_STORAGE' default = {'default': {'TYPE': 'server'}} - command_storage = common_settings.TERMINAL_COMMAND_STORAGE + try: + command_storage = common_settings.TERMINAL_COMMAND_STORAGE + except Exception: + return default if command_storage is None: obj = Setting() obj.name = name @@ -413,7 +416,10 @@ def get_replay_storage_or_create_default_storage(): from common.models import common_settings, Setting name = 'TERMINAL_REPLAY_STORAGE' default = {'default': {'TYPE': 'server'}} - replay_storage = common_settings.TERMINAL_REPLAY_STORAGE + try: + replay_storage = common_settings.TERMINAL_REPLAY_STORAGE + except Exception: + return default if replay_storage is None: obj = Setting() obj.name = name diff --git a/apps/terminal/backends/__init__.py b/apps/terminal/backends/__init__.py index 1c454a32d..0f0ec0cc5 100644 --- a/apps/terminal/backends/__init__.py +++ b/apps/terminal/backends/__init__.py @@ -3,7 +3,6 @@ from django.conf import settings from .command.serializers import SessionCommandSerializer from common import utils -from common.models import common_settings, Setting TYPE_ENGINE_MAPPING = { 'elasticsearch': 'terminal.backends.command.es',