Skip to content

Commit

Permalink
Weldr/ComposeRequest: OSTree options nil if not set
Browse files Browse the repository at this point in the history
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] osbuild/images#1071

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza committed Dec 7, 2024
1 parent 10c068c commit 910e59c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/weldr/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 910e59c

Please sign in to comment.