From 7294f6e5e06ad372eb2d8e79daa8df085cfc724d Mon Sep 17 00:00:00 2001 From: xinwen Date: Fri, 7 May 2021 16:29:47 +0800 Subject: [PATCH] refactor: command es storage `IGNORE_VERIFY_CERTS` --- apps/terminal/backends/command/es.py | 2 +- apps/terminal/serializers/storage.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/terminal/backends/command/es.py b/apps/terminal/backends/command/es.py index e03847e0a..27631d5bc 100644 --- a/apps/terminal/backends/command/es.py +++ b/apps/terminal/backends/command/es.py @@ -34,7 +34,7 @@ class CommandStore(): self.index = config.get("INDEX") or 'jumpserver' self.doc_type = config.get("DOC_TYPE") or 'command_store' - ignore_verify_certs = kwargs.pop('ignore_verify_certs', False) + ignore_verify_certs = kwargs.pop('IGNORE_VERIFY_CERTS', False) if ignore_verify_certs: kwargs['verify_certs'] = None self.es = Elasticsearch(hosts=hosts, max_retries=0, **kwargs) diff --git a/apps/terminal/serializers/storage.py b/apps/terminal/serializers/storage.py index 7f5dec2fe..ff794eef9 100644 --- a/apps/terminal/serializers/storage.py +++ b/apps/terminal/serializers/storage.py @@ -181,9 +181,9 @@ class CommandStorageTypeESSerializer(serializers.Serializer): max_length=1024, default='jumpserver', label=_('Index'), allow_null=True ) DOC_TYPE = ReadableHiddenField(default='command', label=_('Doc type'), allow_null=True) - ignore_verify_certs = serializers.BooleanField( + IGNORE_VERIFY_CERTS = serializers.BooleanField( default=False, label=_('Ignore Certificate Verification'), - source='OTHER.ignore_verify_certs', allow_null=True, + source='OTHER.IGNORE_VERIFY_CERTS', allow_null=True, ) # mapping