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:
parent
00d473c802
commit
fc5461e9e3
5 changed files with 19 additions and 19 deletions
|
|
@ -51,7 +51,7 @@ func (impl *OSTreeResolveJobImpl) Run(job worker.Job) error {
|
||||||
logWithId.Infof("Resolving (%d) ostree commits", len(args.Specs))
|
logWithId.Infof("Resolving (%d) ostree commits", len(args.Specs))
|
||||||
|
|
||||||
for i, s := range args.Specs {
|
for i, s := range args.Specs {
|
||||||
reqParams := ostree.RequestParams{
|
reqParams := ostree.SourceSpec{
|
||||||
URL: s.URL,
|
URL: s.URL,
|
||||||
Ref: s.Ref,
|
Ref: s.Ref,
|
||||||
Parent: s.Parent,
|
Parent: s.Parent,
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ type imageRequest struct {
|
||||||
repositories []rpmmd.RepoConfig
|
repositories []rpmmd.RepoConfig
|
||||||
imageOptions distro.ImageOptions
|
imageOptions distro.ImageOptions
|
||||||
target *target.Target
|
target *target.Target
|
||||||
ostree *ostree.RequestParams
|
ostree *ostree.SourceSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *apiHandlers) PostCompose(ctx echo.Context) error {
|
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
|
// assume it's an ostree image if the type has a default ostree ref
|
||||||
if imageType.OSTreeRef() != "" {
|
if imageType.OSTreeRef() != "" {
|
||||||
ostreeOptions = &ostree.RequestParams{}
|
ostreeOptions = &ostree.SourceSpec{}
|
||||||
if ir.Ostree != nil {
|
if ir.Ostree != nil {
|
||||||
if ir.Ostree.Ref != nil {
|
if ir.Ostree.Ref != nil {
|
||||||
ostreeOptions.Ref = *ir.Ostree.Ref
|
ostreeOptions.Ref = *ir.Ostree.Ref
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
|
||||||
PackageSets []string `json:"package-sets,omitempty"`
|
PackageSets []string `json:"package-sets,omitempty"`
|
||||||
}
|
}
|
||||||
type composeRequest struct {
|
type composeRequest struct {
|
||||||
Distro string `json:"distro"`
|
Distro string `json:"distro"`
|
||||||
Arch string `json:"arch"`
|
Arch string `json:"arch"`
|
||||||
ImageType string `json:"image-type"`
|
ImageType string `json:"image-type"`
|
||||||
Repositories []repository `json:"repositories"`
|
Repositories []repository `json:"repositories"`
|
||||||
Blueprint *blueprint.Blueprint `json:"blueprint"`
|
Blueprint *blueprint.Blueprint `json:"blueprint"`
|
||||||
OSTree *ostree.RequestParams `json:"ostree"`
|
OSTree *ostree.SourceSpec `json:"ostree"`
|
||||||
}
|
}
|
||||||
var tt struct {
|
var tt struct {
|
||||||
ComposeRequest *composeRequest `json:"compose-request"`
|
ComposeRequest *composeRequest `json:"compose-request"`
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ import (
|
||||||
|
|
||||||
var ostreeRefRE = regexp.MustCompile(`^(?:[\w\d][-._\w\d]*\/)*[\w\d][-._\w\d]*$`)
|
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.
|
// a ref, which can then be turned into a CommitSpec.
|
||||||
type RequestParams struct {
|
type SourceSpec struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Ref string `json:"ref"`
|
Ref string `json:"ref"`
|
||||||
Parent string `json:"parent"`
|
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 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.
|
// 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
|
ref = params.Ref
|
||||||
|
|
||||||
// Determine value of ref
|
// Determine value of ref
|
||||||
|
|
|
||||||
|
|
@ -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
|
// https://weldr.io/lorax/pylorax.api.html#pylorax.api.v0.v0_compose_start
|
||||||
type ComposeRequest struct {
|
type ComposeRequest struct {
|
||||||
BlueprintName string `json:"blueprint_name"`
|
BlueprintName string `json:"blueprint_name"`
|
||||||
ComposeType string `json:"compose_type"`
|
ComposeType string `json:"compose_type"`
|
||||||
Size uint64 `json:"size"`
|
Size uint64 `json:"size"`
|
||||||
OSTree ostree.RequestParams `json:"ostree"`
|
OSTree ostree.SourceSpec `json:"ostree"`
|
||||||
Branch string `json:"branch"`
|
Branch string `json:"branch"`
|
||||||
Upload *uploadRequest `json:"upload"`
|
Upload *uploadRequest `json:"upload"`
|
||||||
}
|
}
|
||||||
type ComposeReply struct {
|
type ComposeReply struct {
|
||||||
BuildID uuid.UUID `json:"build_id"`
|
BuildID uuid.UUID `json:"build_id"`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue