fix: 修复迁移数据库应用账号缺少的问题

pull/9586/head
Bai 2023-02-16 14:58:42 +08:00 committed by Jiangjie.Bai
parent b8c872c68e
commit bfa2e285f5
2 changed files with 7 additions and 1 deletions

View File

@ -77,6 +77,11 @@ class CommandStorage(CommonStorageModelMixin, JMSBaseModel):
def config(self):
config = 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)
@property

View File

@ -178,7 +178,6 @@ command_storage_type_serializer_classes_mapping = {
# BaseStorageSerializer
class BaseStorageSerializer(serializers.ModelSerializer):
type = LabeledChoiceField(choices=const.ReplayStorageType.choices, label=_('Type'))
storage_type_serializer_classes_mapping = {}
meta = MethodSerializer()
@ -222,6 +221,7 @@ class BaseStorageSerializer(serializers.ModelSerializer):
# CommandStorageSerializer
class CommandStorageSerializer(BaseStorageSerializer):
type = LabeledChoiceField(choices=const.CommandStorageType.choices, label=_('Type'))
storage_type_serializer_classes_mapping = command_storage_type_serializer_classes_mapping
class Meta(BaseStorageSerializer.Meta):
@ -233,6 +233,7 @@ class CommandStorageSerializer(BaseStorageSerializer):
# ReplayStorageSerializer
class ReplayStorageSerializer(BaseStorageSerializer):
type = LabeledChoiceField(choices=const.ReplayStorageType.choices, label=_('Type'))
storage_type_serializer_classes_mapping = replay_storage_type_serializer_classes_mapping
class Meta(BaseStorageSerializer.Meta):