MCPcopy Index your code
hub / github.com/FairwindsOps/pluto / isReplacementAvailableIn

Method isReplacementAvailableIn

pkg/api/versions.go:247–267  ·  view source on GitHub ↗

isReplacementAvailableIn returns true if the replacement api is available in the applicable targetVersion Will return false if the targetVersion passed is not a valid semver string

(targetVersions map[string]string)

Source from the content-addressed store, hash-verified

245// isReplacementAvailableIn returns true if the replacement api is available in the applicable targetVersion
246// Will return false if the targetVersion passed is not a valid semver string
247func (v *Version) isReplacementAvailableIn(targetVersions map[string]string) bool {
248 for component, targetVersion := range targetVersions {
249 if !semver.IsValid(targetVersion) {
250 klog.V(3).Infof("targetVersion %s for %s is not valid semVer", targetVersion, component)
251 return false
252 }
253 }
254
255 if v.ReplacementAvailableIn == "" {
256 return false
257 }
258
259 targetVersion, ok := targetVersions[v.Component]
260 if !ok {
261 klog.V(3).Infof("targetVersion missing for component %s", v.Component)
262 return false
263 }
264
265 comparison := semver.Compare(targetVersion, v.ReplacementAvailableIn)
266 return comparison >= 0
267}
268
269// PrintVersionList prints out the list of versions
270// in a specific format

Callers 3

FilterOutputMethod · 0.80
GetReturnCodeMethod · 0.80

Calls

no outgoing calls

Tested by 1