weldr/compose: add support for ostree-specific options

Similarly to how some image types accept a size-argument, some image
types require  ostree-specific options. For now this is only used by
Fedora IoT on Fedora 32.

composer-cli nor cockpit-composer currently has the ability to pass in
these options, but the change is backwards compatible and existing image
types are unaffected. If the options are omitted for image types that
require them, sensible defaults are chosen.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-05-21 22:20:51 +02:00
parent b0cfec767a
commit 8f7a9b3439

View file

@ -1506,11 +1506,17 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
return
}
type OSTreeRequest struct {
Ref string `json:"ref"`
Parent string `json:"parent"`
}
// https://weldr.io/lorax/pylorax.api.html#pylorax.api.v0.v0_compose_start
type ComposeRequest struct {
BlueprintName string `json:"blueprint_name"`
ComposeType string `json:"compose_type"`
Size uint64 `json:"size"`
OSTree OSTreeRequest `json:"ostree"`
Branch string `json:"branch"`
Upload *uploadRequest `json:"upload"`
}
@ -1606,6 +1612,10 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
manifest, err := imageType.Manifest(bp.Customizations,
distro.ImageOptions{
Size: size,
OSTree: distro.OSTreeImageOptions{
Ref: cr.OSTree.Ref,
Parent: cr.OSTree.Parent,
},
},
api.allRepositories(),
packages,