Skip to content

Commit

Permalink
fix(backend): 修复tendbcluster重命名校验问题 #6535
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Aug 29, 2024
1 parent cbcaaeb commit 3e22fd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/backend/db_services/mysql/sqlparse/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def parse_show_desc_tokens(tokens):
if keyword[0].upper() in ["DESC", "DESCRIBE", "USE"]:
return True
# 允许show databases,show processlist、show slave status
if keyword[0].upper() == "SHOW" and ids[0] in ["DATABASES", "PROCESSLIST", "SLAVE STATUS"]:
if keyword[0].upper() == "SHOW" and ids and ids[0] in ["DATABASES", "PROCESSLIST", "SLAVE STATUS"]:
return True
# 允许show tables,show create
if len(keyword) > 1 and keyword[0].upper() == "SHOW" and keyword[1].upper() in ["TABLES", "CREATE"]:
Expand Down
9 changes: 8 additions & 1 deletion dbm-ui/backend/ticket/builders/tendbcluster/tendb_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""
from django.utils.translation import ugettext as _

from backend.db_meta.enums import ClusterType
from backend.flow.engine.controller.spider import SpiderController
from backend.ticket import builders
from backend.ticket.builders.mysql.mysql_ha_rename import MySQLHaRenameFlowParamBuilder, MySQLHaRenameSerializer
Expand All @@ -18,7 +19,13 @@


class TendbRenameSerializer(MySQLHaRenameSerializer):
pass
def validate(self, attrs):
super().validate_cluster_can_access(attrs)
# 集群类型校验
super().validated_cluster_type(attrs, cluster_type=ClusterType.TenDBCluster)
# DB重命名校验
super().validate_rename_db(attrs)
return attrs


class TendbRenameFlowParamBuilder(MySQLHaRenameFlowParamBuilder):
Expand Down

0 comments on commit 3e22fd8

Please sign in to comment.