Skip to content

Commit

Permalink
Addressing comments from bcrochet
Browse files Browse the repository at this point in the history
  • Loading branch information
edcdavid authored and acornett21 committed Jan 24, 2024
1 parent b878fb7 commit bb672db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions container/check_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,16 @@ func (c *containerCheck) resolve(ctx context.Context) error {

c.policy = override
}
var err error
c.checks, err = engine.InitializeContainerChecks(ctx, c.policy, engine.ContainerCheckConfig{

newChecks, err := engine.InitializeContainerChecks(ctx, c.policy, engine.ContainerCheckConfig{
DockerConfig: c.dockerconfigjson,
PyxisAPIToken: c.pyxisToken,
CertificationProjectID: c.certificationProjectID,
})
if err != nil {
return fmt.Errorf("%w: %s", preflighterr.ErrCannotInitializeChecks, err)
}
c.checks = newChecks
c.resolved = true

return nil
Expand All @@ -108,8 +109,7 @@ func (c *containerCheck) resolve(ctx context.Context) error {
// List the available container checks. Policy exceptions will be resolved if the proper
// pyxis information is provided.
func (c *containerCheck) List(ctx context.Context) (policy.Policy, []check.Check, error) {
err := c.resolve(ctx)
return c.policy, c.checks, err
return c.policy, c.checks, c.resolve(ctx)
}

// hasPyxisData returns true of the values necessary to make a pyxis
Expand Down
7 changes: 3 additions & 4 deletions operator/check_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ func (c *operatorCheck) resolve(ctx context.Context) error {
}

c.policy = policy.PolicyOperator
var err error
c.checks, err = engine.InitializeOperatorChecks(ctx, c.policy, engine.OperatorCheckConfig{
newChecks, err := engine.InitializeOperatorChecks(ctx, c.policy, engine.OperatorCheckConfig{
ScorecardImage: c.scorecardImage,
ScorecardWaitTime: c.scorecardWaitTime,
ScorecardNamespace: c.scorecardNamespace,
Expand All @@ -97,15 +96,15 @@ func (c *operatorCheck) resolve(ctx context.Context) error {
if err != nil {
return fmt.Errorf("%w: %s", preflighterr.ErrCannotInitializeChecks, err)
}
c.checks = newChecks
c.resolved = true

return nil
}

// List the available operator checks.
func (c operatorCheck) List(ctx context.Context) (policy.Policy, []check.Check, error) {
err := c.resolve(ctx)
return c.policy, c.checks, err
return c.policy, c.checks, c.resolve(ctx)
}

// WithScorecardNamespace configures the namespace value to use for OperatorSDK Scorecard checks.
Expand Down

0 comments on commit bb672db

Please sign in to comment.