From 8d88c6509e3ac1c12a8a564aebb9e04d2b7c73e0 Mon Sep 17 00:00:00 2001 From: Ilya Lesikov Date: Fri, 29 Jul 2022 18:50:31 +0300 Subject: [PATCH] fix(generic): ignore jsonpath errs on Condition search Signed-off-by: Ilya Lesikov --- pkg/utils/json.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/utils/json.go b/pkg/utils/json.go index 3f097b3..8fd8915 100644 --- a/pkg/utils/json.go +++ b/pkg/utils/json.go @@ -17,12 +17,12 @@ func JSONPath(tmpl string, input interface{}) (result string, found bool, err er resultBuf := &bytes.Buffer{} if err := jsonPath.Execute(resultBuf, input); err != nil { - if strings.HasSuffix(err.Error(), " is not found") { - return "", false, nil - } else { - return "", false, fmt.Errorf("error executing jsonpath: %w", err) + if debug() && !strings.HasSuffix(err.Error(), " is not found") { + fmt.Printf("error executing jsonpath for tmpl %q and input %v: %s\n", tmpl, input, err) } + return "", false, nil } + if strings.TrimSpace(resultBuf.String()) == "" { return "", false, nil }