mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-17 17:56:33 +00:00
fix #1192
This commit is contained in:
parent
48b98bd17b
commit
d8d5160bce
3 changed files with 4 additions and 1 deletions
pkg/engine
|
@ -235,7 +235,7 @@ func MatchesResourceDescription(resourceRef unstructured.Unstructured, ruleRef k
|
|||
}
|
||||
|
||||
// creating final error
|
||||
var errorMessage = "rule not matched:"
|
||||
var errorMessage = fmt.Sprintf("rule %s not matched:", ruleRef.Name)
|
||||
for i, reasonForFailure := range reasonsForFailure {
|
||||
if reasonForFailure != nil {
|
||||
errorMessage += "\n " + fmt.Sprint(i+1) + ". " + reasonForFailure.Error()
|
||||
|
|
|
@ -20,6 +20,8 @@ func convertNumberToString(value interface{}) (string, error) {
|
|||
return strconv.FormatInt(typed, 10), nil
|
||||
case int:
|
||||
return strconv.Itoa(typed), nil
|
||||
case nil:
|
||||
return "", fmt.Errorf("got empty string, expect %v", value)
|
||||
default:
|
||||
return "", fmt.Errorf("could not convert %v to string", typed)
|
||||
}
|
||||
|
|
|
@ -274,6 +274,7 @@ func validatePatterns(log logr.Logger, ctx context.EvalInterface, resource unstr
|
|||
|
||||
if path, err := validate.ValidateResourceWithPattern(logger, resource.Object, pattern); err != nil {
|
||||
// validation failed
|
||||
logger.V(5).Info(err.Error())
|
||||
resp.Success = false
|
||||
resp.Message = fmt.Sprintf("Validation error: %s; Validation rule %s failed at path %s",
|
||||
rule.Validation.Message, rule.Name, path)
|
||||
|
|
Loading…
Add table
Reference in a new issue