Skip to content

Commit

Permalink
fix(backend): 资源池mysql、mongodb修复 TencentBlueKing#9351
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 30515
  • Loading branch information
ygcyao committed Feb 18, 2025
1 parent 807b785 commit 8a49d34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions dbm-ui/backend/ticket/builders/mongodb/mongo_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def pre_callback(self):

tmp_cluster_filters = Q()
for cluster_name in cluster_names:
tmp_cluster_filters |= Q(bk_biz_id=bk_biz_id, cluster_type=cluster_type, cluster_name=cluster_name)
tmp_cluster_filters |= Q(bk_biz_id=bk_biz_id, cluster_type=cluster_type, name=cluster_name)
tmp_clusters = Cluster.objects.filter(tmp_cluster_filters)

# 为临时集群添加临时标志和记录
Expand All @@ -125,7 +125,7 @@ def pre_callback(self):
source_cluster_name__cluster: Dict[str, Cluster] = {}
cluster_records: List[ClusterOperateRecord] = []
for cluster in tmp_clusters:
cluster.tag_set.add(temporary_tag)
cluster.tags.add(temporary_tag)
source_cluster_name__cluster[cluster.name.rsplit("-", 2)[0]] = cluster
cluster_records.append(ClusterOperateRecord(cluster_id=cluster.id, ticket=self.ticket, flow=rollback_flow))

Expand All @@ -148,7 +148,7 @@ def pre_callback(self):
rollback_flow.save(update_fields=["details"])


@builders.BuilderFactory.register(TicketType.MONGODB_RESTORE)
@builders.BuilderFactory.register(TicketType.MONGODB_RESTORE, is_apply=True)
class MongoDBRestoreApplyFlowBuilder(BaseMongoDBTicketFlowBuilder):
serializer = MongoDBRestoreDetailSerializer

Expand Down Expand Up @@ -235,7 +235,7 @@ def custom_ticket_flows(self):
cluster_type = self.ticket.details["cluster_type"]
flow_infix = "_" if cluster_type == ClusterType.MongoShardedCluster else "_BATCH_"
resource_apply_flow_type = getattr(FlowType, f"RESOURCE{flow_infix}APPLY")
resource_deliver_flow_type = getattr(FlowType, f"RESOURCE{flow_infix}DELIVERY")
resource_deliver_flow_type = getattr(FlowType, "RESOURCE_DELIVERY")

flows = [
Flow(
Expand Down
6 changes: 3 additions & 3 deletions dbm-ui/backend/ticket/builders/mysql/mysql_migrate_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def post_callback(self):
if "backend_group" in info:
backend = info.pop("backend_group")[0]
info["bk_new_master"], info["bk_new_slave"] = backend["master"], backend["slave"]
# 修改规格key值
info["resource_spec"]["remote"] = info["resource_spec"].pop("master")
info["resource_spec"].pop("slave")
else:
info["bk_new_master"], info["bk_new_slave"] = info.pop("new_master")[0], info.pop("new_slave")[0]
info["new_master_ip"], info["new_slave_ip"] = info["bk_new_master"]["ip"], info["bk_new_slave"]["ip"]
# 修改规格key值
info["resource_spec"]["remote"] = info["resource_spec"].pop("master")
info["resource_spec"].pop("slave")
next_flow.save(update_fields=["details"])


Expand Down

0 comments on commit 8a49d34

Please sign in to comment.