mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
35 lines
852 B
Go
35 lines
852 B
Go
package common
|
|
|
|
import (
|
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
)
|
|
|
|
type SyncClustersAction struct {
|
|
actionutils.ParentAction
|
|
}
|
|
|
|
func (this *SyncClustersAction) RunPost(params struct{}) {
|
|
// TODO 将来可以单独选择某一个集群进行单独的同步
|
|
|
|
// 所有有变化的集群
|
|
clustersResp, err := this.RPC().NodeClusterRPC().FindAllChangedNodeClusters(this.AdminContext(), &pb.FindAllChangedNodeClustersRequest{})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
clusters := clustersResp.Clusters
|
|
|
|
for _, cluster := range clusters {
|
|
_, err := this.RPC().NodeRPC().SyncNodesVersionWithCluster(this.AdminContext(), &pb.SyncNodesVersionWithClusterRequest{
|
|
ClusterId: cluster.Id,
|
|
})
|
|
if err != nil {
|
|
this.ErrorPage(err)
|
|
return
|
|
}
|
|
}
|
|
|
|
this.Success()
|
|
}
|