Skip to content

Commit

Permalink
fix: 修复proxy替换时出现部分新proxy权限不足的bug #3949
Browse files Browse the repository at this point in the history
  • Loading branch information
yksitu authored and zhangzhw8 committed Apr 12, 2024
1 parent 2b02006 commit 1a1c3af
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dbm-ui/backend/flow/utils/mysql/mysql_act_playload.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,12 @@ def get_clone_client_grant_payload(self, **kwargs):
"""
克隆客户端的MySQL权限
"""
if self.cluster.get("is_drop", False):
# 代表是proxy替换,会清理proxy权限,则template_client_host为origin_proxy_ip
template_client_host = self.cluster["origin_proxy_ip"]
else:
# 代表是proxy添加,不清理旧proxy权限, 则template_client_host为template_proxy_ip
template_client_host = self.cluster["template_proxy_ip"]
return {
"db_type": DBActuatorTypeEnum.MySQL.value,
"action": DBActuatorActionEnum.CloneClientGrant.value,
Expand All @@ -650,7 +656,7 @@ def get_clone_client_grant_payload(self, **kwargs):
"extend": {
"host": kwargs["ip"],
"port": self.cluster["mysql_port"],
"template_client_host": self.cluster["template_proxy_ip"],
"template_client_host": template_client_host,
"target_client_host": self.cluster["target_proxy_ip"],
"is_drop": self.cluster.get("is_drop", False),
"origin_client_host": self.cluster.get("origin_proxy_ip", "1.1.1.1"),
Expand Down

0 comments on commit 1a1c3af

Please sign in to comment.