Fix ls -S to deal with broken/unparsable app versions more correctly #385

Closed
cas wants to merge 2 commits from cr_fix_ls-S into cr_dockerinside

View File

@ -176,25 +176,28 @@ can take some time.
appStats.AutoUpdate = autoUpdate
var newUpdates []string
if version != "unknown" {
updates, err := recipe.GetRecipeCatalogueVersions(app.Recipe, catl)
if err != nil {
logrus.Fatal(err)
}
if (version != "unknown") {
Review

(...) not required?

`(...)` not required?
parsedVersion, err := tagcmp.Parse(version)
if err != nil {
logrus.Fatal(err)
}
if (err != nil) {
logrus.Warning("Can't parse ", app.Recipe, " version ", version, " ", err)
} else {
updates, err := recipe.GetRecipeCatalogueVersions(app.Recipe, catl)
for _, update := range updates {
parsedUpdate, err := tagcmp.Parse(update)
if err != nil {
logrus.Fatal(err)
}
if update != version && parsedUpdate.IsGreaterThan(parsedVersion) {
newUpdates = append(newUpdates, update)
for _, update := range updates {
parsedUpdate, err := tagcmp.Parse(update)
if err != nil {
logrus.Warning("can't parse ", app.Recipe," update version ", update, " ", err)
continue
}
if update != version && parsedUpdate.IsGreaterThan(parsedVersion) {
newUpdates = append(newUpdates, update)
}
}
}
}