修复当集群没有绑定DNS域名时无法修改节点DNS信息的Bug

This commit is contained in:
GoEdgeLab
2021-09-11 20:12:06 +08:00
parent 242da2d065
commit 40c5c78d6e
2 changed files with 14 additions and 10 deletions

View File

@@ -85,10 +85,12 @@ func (this *UpdateDNSPopupAction) RunPost(params struct {
defer this.CreateLog(oplogs.LevelInfo, "修改节点 %d 的DNS设置", params.NodeId)
routes := []string{}
err := json.Unmarshal(params.DnsRoutesJSON, &routes)
if err != nil {
this.ErrorPage(err)
return
if len(params.DnsRoutesJSON) > 0 {
err := json.Unmarshal(params.DnsRoutesJSON, &routes)
if err != nil {
this.ErrorPage(err)
return
}
}
params.Must.
@@ -100,7 +102,7 @@ func (this *UpdateDNSPopupAction) RunPost(params struct {
}
// 执行修改
_, err = this.RPC().NodeRPC().UpdateNodeDNS(this.AdminContext(), &pb.UpdateNodeDNSRequest{
_, err := this.RPC().NodeRPC().UpdateNodeDNS(this.AdminContext(), &pb.UpdateNodeDNSRequest{
NodeId: params.NodeId,
IpAddr: params.IpAddr,
DnsDomainId: params.DomainId,