Skip to content

Commit

Permalink
fix(backend): 修复mysql部署版本错传的问题 TencentBlueKing#7464
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud authored and zhangzhw8 committed Oct 21, 2024
1 parent 553c0fb commit 71e110f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dbm-ui/backend/ticket/builders/mysql/mysql_ha_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ def post_callback(self):
@BuilderFactory.register(
TicketType.MYSQL_HA_APPLY, is_apply=True, cluster_type=ClusterType.TenDBHA, iam=ActionEnum.MYSQL_APPLY
)
class MysqlHAApplyFlowBuilder(BaseMySQLHATicketFlowBuilder, MysqlSingleApplyFlowBuilder):
class MysqlHAApplyFlowBuilder(BaseMySQLHATicketFlowBuilder):
serializer = MysqlHAApplyDetailSerializer
inner_flow_builder = MysqlHAApplyFlowParamBuilder
inner_flow_name = _("MySQL高可用部署执行")
resource_apply_builder = MysqlHaApplyResourceParamBuilder

def patch_ticket_detail(self):
super().patch_dbconfig(cluster_type=ClusterType.TenDBHA)
MysqlSingleApplyFlowBuilder.patch_dbconfig(ticket=self.ticket, cluster_type=ClusterType.TenDBHA)
super().patch_ticket_detail()
11 changes: 6 additions & 5 deletions dbm-ui/backend/ticket/builders/mysql/mysql_single_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,14 @@ class MysqlSingleApplyFlowBuilder(BaseMySQLSingleTicketFlowBuilder):
inner_flow_name = _("MySQL单节点部署执行")
resource_apply_builder = MysqlSingleApplyResourceParamBuilder

def patch_dbconfig(self, cluster_type):
@classmethod
def patch_dbconfig(cls, ticket, cluster_type):
# 补充数据库版本和字符集
db_config = DBConfigApi.query_conf_item(
{
"bk_biz_id": str(self.ticket.bk_biz_id),
"bk_biz_id": str(ticket.bk_biz_id),
"level_name": dbconf_const.LevelName.MODULE,
"level_value": str(self.ticket.details["db_module_id"]),
"level_value": str(ticket.details["db_module_id"]),
"conf_file": dbconf_const.DEPLOY_FILE_NAME,
"conf_type": dbconf_const.ConfType.DEPLOY,
"namespace": cluster_type,
Expand All @@ -226,8 +227,8 @@ def patch_dbconfig(self, cluster_type):
if not db_config.get("db_version") or not db_config.get("charset"):
raise TicketParamsVerifyException(_("获取数据库配置失败,请检查获取参数db_config: {}").format(db_config))

self.ticket.update_details(db_version=db_config.get("db_version"), charset=db_config.get("charset"))
ticket.update_details(db_version=db_config.get("db_version"), charset=db_config.get("charset"))

def patch_ticket_detail(self):
self.patch_dbconfig(cluster_type=ClusterType.TenDBSingle)
self.patch_dbconfig(ticket=self.ticket, cluster_type=ClusterType.TenDBSingle)
super().patch_ticket_detail()

0 comments on commit 71e110f

Please sign in to comment.