mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
small fix
This commit is contained in:
parent
643fe77394
commit
d01d5226a6
1 changed files with 7 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue