weldr: support more package set names

Weldr makes assumptions about the names of the package sets. This
does not work in all cases, so should be reworked, but for now just
do enough that we don't regress.
This commit is contained in:
Tom Gundersen 2022-07-01 14:08:07 +01:00
parent ff1451d8ce
commit ad847a6fca

View file

@ -2347,12 +2347,21 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
return
}
var packages []rpmmd.PackageSpec
// TODO: introduce a way to query these from the manifest / image type
// BUG: installer/container image types will have empty package sets
if packages = packageSets["packages"]; len(packages) == 0 {
if packages = packageSets["os"]; len(packages) == 0 {
packages = packageSets["ostree-tree"]
}
}
if testMode == "1" {
// Create a failed compose
err = api.store.PushTestCompose(composeID, manifest, imageType, bp, size, targets, false, packageSets["packages"])
err = api.store.PushTestCompose(composeID, manifest, imageType, bp, size, targets, false, packages)
} else if testMode == "2" {
// Create a successful compose
err = api.store.PushTestCompose(composeID, manifest, imageType, bp, size, targets, true, packageSets["packages"])
err = api.store.PushTestCompose(composeID, manifest, imageType, bp, size, targets, true, packages)
} else {
var jobId uuid.UUID
@ -2365,7 +2374,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
},
}, "")
if err == nil {
err = api.store.PushCompose(composeID, manifest, imageType, bp, size, targets, jobId, packageSets["packages"])
err = api.store.PushCompose(composeID, manifest, imageType, bp, size, targets, jobId, packages)
}
}