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

small fix

This commit is contained in:
NoSkillGirl 2020-07-07 17:40:54 +05:30
parent 643fe77394
commit d01d5226a6

View file

@ -40,16 +40,17 @@ func Command() *cobra.Command {
invalidPolicyFound := false
for _, policy := range policies {
// err = policyvalidate.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController)
if common.PolicyHasVariables(*policy) {
invalidPolicyFound = true
fmt.Printf("Policy %s is invalid.\n", policy.Name)
log.Log.Error(errors.New("'validate' does not support policies with variables"), "Policy "+policy.Name+" is invalid")
continue
}
err := policy2.Validate(utils.MarshalPolicy(*policy), nil, true, openAPIController)
if err != nil {
fmt.Printf("Policy %s is invalid.\n\n", policy.Name)
fmt.Printf("Policy %s is invalid.\n", policy.Name)
log.Log.Error(err, "policy "+policy.Name+" is invalid")
invalidPolicyFound = true
} else if common.PolicyHasVariables(*policy) {
invalidPolicyFound = true
fmt.Printf("Policy %s is invalid.\n\n", policy.Name)
log.Log.Error(errors.New("'validate' does not support policies with variables"), "Policy "+policy.Name+" is invalid")
} else {
fmt.Printf("Policy %s is valid.\n\n", policy.Name)
}