1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

Added different exit code(3) on invalid policy

This commit is contained in:
NoSkillGirl 2020-06-08 11:50:56 +05:30
parent c605f316cb
commit 2d74937bd6

View file

@ -2,6 +2,7 @@ package validate
import (
"fmt"
"os"
"github.com/nirmata/kyverno/pkg/utils"
@ -34,15 +35,20 @@ func Command() *cobra.Command {
return err
}
invalidPolicyFound := false
for _, policy := range policies {
err = policyvalidate.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController)
if err != nil {
fmt.Println("Policy " + policy.Name + " is invalid")
invalidPolicyFound = true
} else {
fmt.Println("Policy " + policy.Name + " is valid")
}
}
if invalidPolicyFound == true {
os.Exit(3)
}
return nil
},
}