Skip to content

Commit

Permalink
Removes unnecessary constructor wrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
  • Loading branch information
m1kola committed Jun 8, 2023
1 parent 3d30ad0 commit 80a5786
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions internal/resolution/variable_sources/olm/olm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func (o *OLMVariableSource) GetVariables(ctx context.Context, entitySource input

// build required package variable sources
for _, operator := range o.operators {
rps, err := o.requiredPackageFromOperator(&operator)
rps, err := required_package.NewRequiredPackage(
operator.Spec.PackageName,
required_package.InVersionRange(operator.Spec.Version),
required_package.InChannel(operator.Spec.Channel),
)
if err != nil {
return nil, err
}
Expand All @@ -40,14 +44,3 @@ func (o *OLMVariableSource) GetVariables(ctx context.Context, entitySource input
variableSource := crd_constraints.NewCRDUniquenessConstraintsVariableSource(bundles_and_dependencies.NewBundlesAndDepsVariableSource(inputVariableSources...))
return variableSource.GetVariables(ctx, entitySource)
}

func (o *OLMVariableSource) requiredPackageFromOperator(operator *operatorsv1alpha1.Operator) (*required_package.RequiredPackageVariableSource, error) {
var opts []required_package.RequiredPackageOption
if operator.Spec.Version != "" {
opts = append(opts, required_package.InVersionRange(operator.Spec.Version))
}
if operator.Spec.Channel != "" {
opts = append(opts, required_package.InChannel(operator.Spec.Channel))
}
return required_package.NewRequiredPackage(operator.Spec.PackageName, opts...)
}

0 comments on commit 80a5786

Please sign in to comment.