From b7bc48835036d906a1ddb4b64e5e0e05b56565ce Mon Sep 17 00:00:00 2001 From: iSecloud <869820505@qq.com> Date: Tue, 27 Aug 2024 11:30:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(backend):=20redis=E4=B8=BB=E4=BB=8E?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E5=90=AF=E7=94=A8=E5=8D=95=E6=8D=AE=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20#6473?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/ticket/builders/doris/doris_apply.py | 5 ++++- dbm-ui/backend/ticket/builders/redis/redis_close.py | 4 ++-- dbm-ui/backend/ticket/builders/redis/redis_open.py | 4 ++-- dbm-ui/backend/ticket/constants.py | 2 -- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dbm-ui/backend/ticket/builders/doris/doris_apply.py b/dbm-ui/backend/ticket/builders/doris/doris_apply.py index 4415b3ada5..6102af970f 100644 --- a/dbm-ui/backend/ticket/builders/doris/doris_apply.py +++ b/dbm-ui/backend/ticket/builders/doris/doris_apply.py @@ -9,6 +9,8 @@ specific language governing permissions and limitations under the License. """ import logging +import random +import string from django.utils.crypto import get_random_string from django.utils.translation import ugettext_lazy as _ @@ -84,7 +86,8 @@ def format_ticket_data(self): """ """ self.ticket_data.update( { - "username": get_random_string(8), + # doris 用户名首位需要字母 + "username": random.choice(string.ascii_letters) + get_random_string(7), "password": get_random_string(16), "domain": f"doris.{self.ticket_data['cluster_name']}.{self.ticket_data['db_app_abbr']}.db", } diff --git a/dbm-ui/backend/ticket/builders/redis/redis_close.py b/dbm-ui/backend/ticket/builders/redis/redis_close.py index d4897b7a51..7f92ff7e9b 100644 --- a/dbm-ui/backend/ticket/builders/redis/redis_close.py +++ b/dbm-ui/backend/ticket/builders/redis/redis_close.py @@ -57,11 +57,11 @@ class RedisInstanceCloseDetailSerializer(SkipToRepresentationMixin, serializers. class RedisInstanceCloseFlowParamBuilder(builders.FlowParamBuilder): - controller = RedisController.fake_scene + controller = RedisController.redis_ins_open_close_scene @builders.BuilderFactory.register( - TicketType.REDIS_INSTANCE_PROXY_CLOSE, phase=ClusterPhase.OFFLINE, iam=ActionEnum.REDIS_OPEN_CLOSE + TicketType.REDIS_INSTANCE_CLOSE, phase=ClusterPhase.OFFLINE, iam=ActionEnum.REDIS_OPEN_CLOSE ) class RedisInstanceCloseFlowBuilder(BaseRedisTicketFlowBuilder): serializer = RedisInstanceCloseDetailSerializer diff --git a/dbm-ui/backend/ticket/builders/redis/redis_open.py b/dbm-ui/backend/ticket/builders/redis/redis_open.py index 0a58caeac9..2b42e2789c 100644 --- a/dbm-ui/backend/ticket/builders/redis/redis_open.py +++ b/dbm-ui/backend/ticket/builders/redis/redis_open.py @@ -54,11 +54,11 @@ class RedisInstanceOpenDetailSerializer(SkipToRepresentationMixin, serializers.S class RedisInstanceOpenFlowParamBuilder(builders.FlowParamBuilder): - controller = RedisController.fake_scene + controller = RedisController.redis_ins_open_close_scene @builders.BuilderFactory.register( - TicketType.REDIS_INSTANCE_PROXY_OPEN, phase=ClusterPhase.ONLINE, iam=ActionEnum.REDIS_OPEN_CLOSE + TicketType.REDIS_INSTANCE_OPEN, phase=ClusterPhase.ONLINE, iam=ActionEnum.REDIS_OPEN_CLOSE ) class RedisInstanceCloseFlowBuilder(BaseRedisTicketFlowBuilder): serializer = RedisInstanceOpenDetailSerializer diff --git a/dbm-ui/backend/ticket/constants.py b/dbm-ui/backend/ticket/constants.py index d3f1093cda..4804dcb60f 100644 --- a/dbm-ui/backend/ticket/constants.py +++ b/dbm-ui/backend/ticket/constants.py @@ -294,8 +294,6 @@ def get_db_type_by_ticket(cls, ticket_type, raise_exception=False): REDIS_INSTANCE_OPEN = TicketEnumField("REDIS_INSTANCE_OPEN", _("Redis 主从启用"), register_iam=False) REDIS_INSTANCE_CLOSE = TicketEnumField("REDIS_INSTANCE_CLOSE", _("Redis 主从禁用"), register_iam=False) REDIS_DESTROY = TicketEnumField("REDIS_DESTROY", _("Redis 集群删除"), _("集群管理")) - REDIS_INSTANCE_PROXY_OPEN = TicketEnumField("REDIS_INSTANCE_PROXY_OPEN", _("Redis 主从集群启用"), register_iam=False) - REDIS_INSTANCE_PROXY_CLOSE = TicketEnumField("REDIS_INSTANCE_PROXY_CLOSE", _("Redis 主从集群禁用"), register_iam=False) # noqa REDIS_INSTANCE_DESTROY = TicketEnumField("REDIS_INSTANCE_DESTROY", _("Redis 主从集群删除"), _("集群管理")) REDIS_PURGE = TicketEnumField("REDIS_PURGE", _("Redis 集群清档"), _("集群管理"))