Skip to content

Commit

Permalink
fix(backend): redis主从禁用启用单据修复 #6473
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Aug 27, 2024
1 parent 5794e33 commit b7bc488
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion dbm-ui/backend/ticket/builders/doris/doris_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 _
Expand Down Expand Up @@ -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",
}
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/backend/ticket/builders/redis/redis_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/backend/ticket/builders/redis/redis_open.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions dbm-ui/backend/ticket/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 集群清档"), _("集群管理"))

Expand Down

0 comments on commit b7bc488

Please sign in to comment.