1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
This commit is contained in:
Jim Bugwadia 2021-10-02 16:57:40 -07:00
parent e0e6074afc
commit 89d1e4afab
3 changed files with 4 additions and 5 deletions

View file

@ -12,9 +12,8 @@ import (
"github.com/kyverno/kyverno/pkg/engine/wildcards"
)
type PatternError struct {
Err error
Err error
Path string
Skip bool
}

View file

@ -459,7 +459,7 @@ func (v *validator) validatePatterns(resource unstructured.Unstructured) *respon
if v.pattern != nil {
if err := validate.MatchPattern(v.log, resource.Object, v.pattern); err != nil {
if pe, ok := err.(*validate.PatternError); ok{
if pe, ok := err.(*validate.PatternError); ok {
v.log.V(3).Info("validation error", "path", pe.Path, "error", err.Error())
if pe.Path == "" {
return ruleResponse(v.rule, v.buildErrorMessage(err, ""), response.RuleStatusError)

View file

@ -60,7 +60,7 @@ func (v *Validate) Validate() (string, error) {
func (v *Validate) validateElements() error {
count := validationElemCount(v.rule)
if count == 0 {
if count == 0 {
return fmt.Errorf("one of pattern, anyPattern, deny, foreach must be specified")
}
@ -106,7 +106,7 @@ func (v *Validate) validateForEach(foreach *kyverno.ForEachValidation) error {
}
count := foreachElemCount(foreach)
if count == 0 {
if count == 0 {
return fmt.Errorf("one of pattern, anyPattern, deny must be specified")
}