实现远程升级节点

This commit is contained in:
GoEdgeLab
2020-10-28 12:35:36 +08:00
parent c13b8b99c5
commit 9c6a8c64a1
8 changed files with 286 additions and 20 deletions

View File

@@ -548,6 +548,24 @@ func (this *NodeDAO) FindAllNotInstalledNodesWithClusterId(clusterId int64) (res
return
}
// 查找所有低于某个版本的节点
func (this *NodeDAO) FindAllLowerVersionNodesWithClusterId(clusterId int64, os string, arch string, version string) (result []*Node, err error) {
_, err = this.Query().
State(NodeStateEnabled).
Attr("clusterId", clusterId).
Where("status IS NOT NULL").
Where("JSON_EXTRACT(status, '$.os')=:os").
Where("JSON_EXTRACT(status, '$.arch')=:arch").
Where("INET_ATON(JSON_UNQUOTE(JSON_EXTRACT(status, '$.buildVersion')))<INET_ATON(:version)").
Param("os", os).
Param("arch", arch).
Param("version", version).
DescPk().
Slice(&result).
FindAll()
return
}
// 生成唯一ID
func (this *NodeDAO) genUniqueId() (string, error) {
for {