mirror of https://github.com/jumpserver/jumpserver
fix: 修复创建 es 命令存储后台 meta.hosts 被修改的问题;deepcopy dict list value 在创建操作日志的时候
parent
bfa2e285f5
commit
726f90ab16
|
@ -1,4 +1,5 @@
|
|||
import codecs
|
||||
import copy
|
||||
import csv
|
||||
from itertools import chain
|
||||
|
||||
|
@ -76,8 +77,8 @@ def _get_instance_field_value(
|
|||
|
||||
if getattr(f, 'primary_key', False):
|
||||
f.verbose_name = 'id'
|
||||
elif isinstance(value, list):
|
||||
value = [str(v) for v in value]
|
||||
elif isinstance(value, (list, dict)):
|
||||
value = copy.deepcopy(value)
|
||||
elif isinstance(f, models.OneToOneField) and isinstance(value, models.Model):
|
||||
nested_data = _get_instance_field_value(
|
||||
value, include_model_fields, model_need_continue_fields, ('id',)
|
||||
|
|
|
@ -75,14 +75,9 @@ class CommandStorage(CommonStorageModelMixin, JMSBaseModel):
|
|||
|
||||
@property
|
||||
def config(self):
|
||||
config = self.meta
|
||||
config = copy.deepcopy(self.meta)
|
||||
config.update({'TYPE': self.type})
|
||||
# 处理 hosts 对象, 正常应该是list, 但是有时候是 str, debug 未果
|
||||
hosts = config.get('HOSTS', [])
|
||||
if isinstance(hosts, str) and ',' in hosts:
|
||||
hosts = hosts.split(',')
|
||||
config['HOSTS'] = hosts
|
||||
return copy.deepcopy(config)
|
||||
return config
|
||||
|
||||
@property
|
||||
def valid_config(self):
|
||||
|
|
Loading…
Reference in New Issue