Пример #1
0
func (c *ConfigRepository) IsMinApiVersion(v string) bool {
	var apiVersion string
	c.read(func() {
		apiVersion = c.data.ApiVersion
	})

	requiredVersion := utils.NewVersion(v)
	cliVersion := utils.NewVersion(apiVersion)
	return cliVersion.GreaterThanOrEqual(requiredVersion)
}
Пример #2
0
func (cmd *CliRpcCmd) IsMinCliVersion(version string, retVal *bool) error {
	if cf.Version == "BUILT_FROM_SOURCE" {
		*retVal = true
	} else {
		curVersion := utils.NewVersion(cf.Version)
		requiredVersion := utils.NewVersion(version)
		*retVal = curVersion.GreaterThanOrEqual(requiredVersion)
	}

	return nil
}
Пример #3
0
func (c *ConfigRepository) IsMinCliVersion(version string) bool {
	if version == "BUILT_FROM_SOURCE" {
		return true
	}
	var minCliVersion string
	c.read(func() {
		minCliVersion = c.data.MinCliVersion
	})
	if minCliVersion == "" {
		return true
	}

	minCliVersion = strings.Split(minCliVersion, "-")[0]
	requiredVersion := utils.NewVersion(version)
	cliVersion := utils.NewVersion(minCliVersion)

	return requiredVersion.GreaterThanOrEqual(cliVersion)
}