远程升级API节点限制版本号必须不小于0.6.4

This commit is contained in:
刘祥超
2023-03-05 15:32:27 +08:00
parent 52bb753594
commit bc6de68006
2 changed files with 5 additions and 1 deletions

View File

@@ -67,7 +67,7 @@ func (this *Upgrader) Upgrade() error {
return err return err
} }
if !Tea.IsTesting() /** 开发环境下允许突破此限制方便测试 **/ && if !Tea.IsTesting() /** 开发环境下允许突破此限制方便测试 **/ &&
(stringutil.VersionCompare(versionResp.Version, "0.6.4" /** 从0.6.4开始支持 **/) <= 0 || versionResp.Os != runtime.GOOS || versionResp.Arch != runtime.GOARCH) { (stringutil.VersionCompare(versionResp.Version, "0.6.4" /** 从0.6.4开始支持 **/) < 0 || versionResp.Os != runtime.GOOS || versionResp.Arch != runtime.GOARCH) {
return errors.New("could not upgrade api node v" + versionResp.Version + "/" + versionResp.Os + "/" + versionResp.Arch) return errors.New("could not upgrade api node v" + versionResp.Version + "/" + versionResp.Os + "/" + versionResp.Arch)
} }

View File

@@ -20,6 +20,10 @@ func CanUpgrade(apiVersion string, osName string, arch string) (canUpgrade bool,
return false, "current api version should not be empty" return false, "current api version should not be empty"
} }
if stringutil.VersionCompare(apiVersion, "0.6.4") < 0 {
return false, "api node version must greater than or equal to 0.6.4"
}
if osName != runtime.GOOS { if osName != runtime.GOOS {
return false, "os not match: " + osName return false, "os not match: " + osName
} }