From 910e59cebc5a4cda1f5a38be0b7122df16319f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Sat, 7 Dec 2024 15:23:18 +0100 Subject: [PATCH] Weldr/ComposeRequest: OSTree options `nil` if not set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the `OSTree` property in the Weldr API `ComposeRequest` struct was not a pointer to the `ostree.ImageOptions` type. As a result, it was initialized to an empty struct, even if not set in the client API call. As a result, the `OSTree` property in the `distro.ImageOptions` was always not `nil`, when initializing the osbuild manifest. However, after a change in `osbuild/images` [0], providing OSTree options for non-OSTree image types is no longer considered valid. This caused a failure to submit a new compose for any non-OSTree image type. Change the `OSTree` property in Weldr `ComposeRequest` to be a pointer and mark it as optional. [0] https://github.com/osbuild/images/pull/1071 Signed-off-by: Tomáš Hozza --- internal/weldr/api.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/weldr/api.go b/internal/weldr/api.go index b4f766918a..c31e1c899a 100644 --- a/internal/weldr/api.go +++ b/internal/weldr/api.go @@ -2415,12 +2415,12 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request // 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 ostree.ImageOptions `json:"ostree"` - Branch string `json:"branch"` - Upload *uploadRequest `json:"upload"` + BlueprintName string `json:"blueprint_name"` + ComposeType string `json:"compose_type"` + Size uint64 `json:"size"` + OSTree *ostree.ImageOptions `json:"ostree,omitempty"` + Branch string `json:"branch"` + Upload *uploadRequest `json:"upload"` } type ComposeReply struct { BuildID uuid.UUID `json:"build_id"` @@ -2549,7 +2549,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request options := distro.ImageOptions{ Size: size, - OSTree: &cr.OSTree, + OSTree: cr.OSTree, PartitioningMode: pm, } options.Facts = &facts.ImageOptions{