ostree: rewrite Resolve() to take SourceSpec and return CommitSpec

The Resolve() function is now only responsible for resolving a
SourceSpec to a CommitSpec.  It only resolves a checksum if a URL is set
and sets the option for the RHSM secrets.

The Parent has been removed from the SourceSpec.  The SourceSpec is a
simple reference to a single ostree ref and has no connection with the
ostree options.
This commit is contained in:
Achilleas Koutsou 2023-06-06 16:55:50 +02:00 committed by Ondřej Budai
parent 3a42770548
commit 7e2855bbb3
4 changed files with 35 additions and 56 deletions

View file

@ -52,13 +52,12 @@ func (impl *OSTreeResolveJobImpl) Run(job worker.Job) error {
for i, s := range args.Specs {
reqParams := ostree.SourceSpec{
URL: s.URL,
Ref: s.Ref,
Parent: s.Parent,
RHSM: s.RHSM,
URL: s.URL,
Ref: s.Ref,
RHSM: s.RHSM,
}
ref, checksum, err := ostree.Resolve(reqParams)
commitSpec, err := ostree.Resolve(reqParams)
if err != nil {
logWithId.Infof("Resolving ostree params failed: %v", err)
setError(err, &result)
@ -66,9 +65,9 @@ func (impl *OSTreeResolveJobImpl) Run(job worker.Job) error {
}
result.Specs[i] = worker.OSTreeResolveResultSpec{
URL: s.URL,
Ref: ref,
Checksum: checksum,
URL: commitSpec.URL,
Ref: commitSpec.Ref,
Checksum: commitSpec.Checksum,
RHSM: s.RHSM,
}
}