cloudapi: add support for additional packages
Optionally allow a pacakge set to be included in the compose request. The specified packages are added to the base packages before depsolving. As the base packages differ between the image types the package customizations may have different results on the different images part of the compose request. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
e878752f6e
commit
e513905424
4 changed files with 25 additions and 7 deletions
|
|
@ -77,6 +77,20 @@ func (server *Server) Compose(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
var bp = blueprint.Blueprint{}
|
||||
err = bp.Initialize()
|
||||
if err != nil {
|
||||
http.Error(w, "Unable to initialize blueprint", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if request.Customizations != nil && request.Customizations.Packages != nil {
|
||||
for _, p := range *request.Customizations.Packages {
|
||||
bp.Packages = append(bp.Packages, blueprint.Package{
|
||||
Name: p,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type imageRequest struct {
|
||||
manifest distro.Manifest
|
||||
arch string
|
||||
|
|
@ -118,13 +132,6 @@ func (server *Server) Compose(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
var bp = blueprint.Blueprint{}
|
||||
err = bp.Initialize()
|
||||
if err != nil {
|
||||
http.Error(w, "Unable to initialize blueprint", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
packageSpecs, excludePackageSpecs := imageType.Packages(bp)
|
||||
packages, _, err := server.rpmMetadata.Depsolve(packageSpecs, excludePackageSpecs, repositories, distribution.ModulePlatformID(), arch.Name())
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue