Skip to content

Commit 4245316

Browse files
committed
rename nopolicies to ignore; change logger msg type
Signed-off-by: Sylwester Piskozub <sylwesterpiskozub@gmail.com>
1 parent 287aa65 commit 4245316

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

app/cli/cmd/policy_develop_eval.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ evaluates the policy against the provided material or attestation.`,
7070

7171
case len(result.Violations) > 0:
7272
for _, violation := range result.Violations {
73-
logger.Error().Msgf("- %s", violation)
73+
logger.Info().Msgf("- %s", violation)
7474
}
75-
logger.Error().Msg("policy evaluation failed")
75+
logger.Info().Msg("policy evaluation failed")
7676

7777
default:
78-
if result.NoPolicies {
79-
logger.Info().Msg("no policies apply to the material")
78+
if result.Ignored {
79+
logger.Info().Msg("policy was ignored")
8080
}
8181
logger.Info().Msg("policy evaluation passed")
8282
}

app/cli/internal/action/policy_develop_eval.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ type PolicyEvalOpts struct {
3030
}
3131

3232
type PolicyEvalResult struct {
33-
NoPolicies bool
3433
Skipped bool
3534
SkipReasons []string
3635
Violations []string
36+
Ignored bool
3737
}
3838

3939
type PolicyEval struct {
@@ -64,7 +64,7 @@ func (action *PolicyEval) Run() (*PolicyEvalResult, error) {
6464
}
6565

6666
return &PolicyEvalResult{
67-
NoPolicies: result.NoPolicies,
67+
Ignored: result.Ignored,
6868
Skipped: result.Skipped,
6969
SkipReasons: result.SkipReasons,
7070
Violations: result.Violations,

app/cli/internal/policydevel/eval.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ type EvalOptions struct {
3737
}
3838

3939
type EvalResult struct {
40-
NoPolicies bool
4140
Skipped bool
4241
SkipReasons []string
4342
Violations []string
43+
Ignored bool
4444
}
4545

4646
func Evaluate(opts *EvalOptions, logger zerolog.Logger) (*EvalResult, error) {
@@ -89,17 +89,17 @@ func verifyMaterial(schema *v1.CraftingSchema, material *v12.Attestation_Materia
8989
}
9090

9191
result := &EvalResult{
92-
NoPolicies: true,
9392
Skipped: false,
9493
SkipReasons: []string{},
9594
Violations: []string{},
95+
Ignored: true,
9696
}
9797

9898
if len(evs) == 0 {
9999
return result, nil
100100
}
101101

102-
result.NoPolicies = false
102+
result.Ignored = false
103103
result.Skipped = evs[0].GetSkipped()
104104
result.SkipReasons = evs[0].SkipReasons
105105
result.Violations = make([]string, 0, len(evs[0].Violations))

0 commit comments

Comments
 (0)