ostree: rename RequestParams to SourceSpec

Same as with the container SourceSpec, the struct specifies the required
information to resolve an ostree commit from a source (URL, ref, and
optional parent).
Renaming for consistency.
This commit is contained in:
Achilleas Koutsou 2023-05-05 13:51:07 +02:00 committed by Simon de Vlieger
parent 00d473c802
commit fc5461e9e3
5 changed files with 19 additions and 19 deletions

View file

@ -51,7 +51,7 @@ func (impl *OSTreeResolveJobImpl) Run(job worker.Job) error {
logWithId.Infof("Resolving (%d) ostree commits", len(args.Specs))
for i, s := range args.Specs {
reqParams := ostree.RequestParams{
reqParams := ostree.SourceSpec{
URL: s.URL,
Ref: s.Ref,
Parent: s.Parent,

View file

@ -115,7 +115,7 @@ type imageRequest struct {
repositories []rpmmd.RepoConfig
imageOptions distro.ImageOptions
target *target.Target
ostree *ostree.RequestParams
ostree *ostree.SourceSpec
}
func (h *apiHandlers) PostCompose(ctx echo.Context) error {
@ -458,10 +458,10 @@ func (h *apiHandlers) PostCompose(ctx echo.Context) error {
}
}
var ostreeOptions *ostree.RequestParams
var ostreeOptions *ostree.SourceSpec
// assume it's an ostree image if the type has a default ostree ref
if imageType.OSTreeRef() != "" {
ostreeOptions = &ostree.RequestParams{}
ostreeOptions = &ostree.SourceSpec{}
if ir.Ostree != nil {
if ir.Ostree.Ref != nil {
ostreeOptions.Ref = *ir.Ostree.Ref

View file

@ -40,12 +40,12 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
PackageSets []string `json:"package-sets,omitempty"`
}
type composeRequest struct {
Distro string `json:"distro"`
Arch string `json:"arch"`
ImageType string `json:"image-type"`
Repositories []repository `json:"repositories"`
Blueprint *blueprint.Blueprint `json:"blueprint"`
OSTree *ostree.RequestParams `json:"ostree"`
Distro string `json:"distro"`
Arch string `json:"arch"`
ImageType string `json:"image-type"`
Repositories []repository `json:"repositories"`
Blueprint *blueprint.Blueprint `json:"blueprint"`
OSTree *ostree.SourceSpec `json:"ostree"`
}
var tt struct {
ComposeRequest *composeRequest `json:"compose-request"`

View file

@ -19,9 +19,9 @@ import (
var ostreeRefRE = regexp.MustCompile(`^(?:[\w\d][-._\w\d]*\/)*[\w\d][-._\w\d]*$`)
// RequestParams serves as input for ResolveParams, and contains all necessary variables to resolve
// SourceSpec serves as input for ResolveParams, and contains all necessary variables to resolve
// a ref, which can then be turned into a CommitSpec.
type RequestParams struct {
type SourceSpec struct {
URL string `json:"url"`
Ref string `json:"ref"`
Parent string `json:"parent"`
@ -145,7 +145,7 @@ func ResolveRef(location, ref string, consumerCerts bool, subs *rhsm.Subscriptio
// If Parent is not specified in the RequestParams, the value of Ref is used.
//
// If any ref (Ref or Parent) is malformed, the function returns with a RefError.
func ResolveParams(params RequestParams) (ref, checksum string, err error) {
func ResolveParams(params SourceSpec) (ref, checksum string, err error) {
ref = params.Ref
// Determine value of ref

View file

@ -2352,12 +2352,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.RequestParams `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.SourceSpec `json:"ostree"`
Branch string `json:"branch"`
Upload *uploadRequest `json:"upload"`
}
type ComposeReply struct {
BuildID uuid.UUID `json:"build_id"`