distro: remove OSTreeImageOptions type and use ostree.RequestParams
This commit is contained in:
parent
102c322ec9
commit
f885de4c68
5 changed files with 9 additions and 13 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
|
|
@ -145,7 +146,7 @@ func main() {
|
|||
manifest, err := imageType.Manifest(composeRequest.Blueprint.Customizations,
|
||||
distro.ImageOptions{
|
||||
Size: imageType.Size(0),
|
||||
OSTree: distro.OSTreeImageOptions{
|
||||
OSTree: ostree.RequestParams{
|
||||
Ref: composeRequest.OSTree.Ref,
|
||||
Parent: composeRequest.OSTree.Parent,
|
||||
URL: composeRequest.OSTree.URL,
|
||||
|
|
|
|||
|
|
@ -275,11 +275,11 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
|||
// set default ostree ref, if one not provided
|
||||
ostreeOptions := ir.Ostree
|
||||
if ostreeOptions == nil || ostreeOptions.Ref == nil {
|
||||
imageOptions.OSTree = distro.OSTreeImageOptions{Ref: imageType.OSTreeRef()}
|
||||
imageOptions.OSTree = ostree.RequestParams{Ref: imageType.OSTreeRef()}
|
||||
} else if !ostree.VerifyRef(*ostreeOptions.Ref) {
|
||||
return HTTPError(ErrorInvalidOSTreeRef)
|
||||
} else {
|
||||
imageOptions.OSTree = distro.OSTreeImageOptions{Ref: *ostreeOptions.Ref}
|
||||
imageOptions.OSTree = ostree.RequestParams{Ref: *ostreeOptions.Ref}
|
||||
}
|
||||
|
||||
var parent string
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import (
|
|||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -127,18 +128,11 @@ type ImageType interface {
|
|||
|
||||
// The ImageOptions specify options for a specific image build
|
||||
type ImageOptions struct {
|
||||
OSTree OSTreeImageOptions
|
||||
OSTree ostree.RequestParams
|
||||
Size uint64
|
||||
Subscription *SubscriptionImageOptions
|
||||
}
|
||||
|
||||
// The OSTreeImageOptions specify ostree-specific image options
|
||||
type OSTreeImageOptions struct {
|
||||
Ref string
|
||||
Parent string
|
||||
URL string
|
||||
}
|
||||
|
||||
// The SubscriptionImageOptions specify subscription-specific image options
|
||||
// ServerUrl denotes the host to register the system with
|
||||
// BaseUrl specifies the repository URL for DNF
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
|
|||
got, err := imageType.Manifest(tt.ComposeRequest.Blueprint.Customizations,
|
||||
distro.ImageOptions{
|
||||
Size: imageType.Size(0),
|
||||
OSTree: distro.OSTreeImageOptions{
|
||||
OSTree: ostree.RequestParams{
|
||||
Ref: imageType.OSTreeRef(),
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2300,7 +2300,7 @@ func (api *API) composeHandler(writer http.ResponseWriter, request *http.Request
|
|||
manifest, err := imageType.Manifest(bp.Customizations,
|
||||
distro.ImageOptions{
|
||||
Size: size,
|
||||
OSTree: distro.OSTreeImageOptions{
|
||||
OSTree: ostree.RequestParams{
|
||||
Ref: cr.OSTree.Ref,
|
||||
Parent: cr.OSTree.Parent,
|
||||
URL: cr.OSTree.URL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue