diff --git a/pkg/csprofiles/csprofiles.go b/pkg/csprofiles/csprofiles.go index c5b72e795..fdb8a0ed9 100644 --- a/pkg/csprofiles/csprofiles.go +++ b/pkg/csprofiles/csprofiles.go @@ -84,8 +84,12 @@ PROFILE_LOOP: log.Warningf("failed to run whitelist expr : %v", err) return nil, errors.Wrapf(err, "while running expression %s", profile.Filters[eIdx]) } + switch out := output.(type) { case bool: + if profile.Debug != nil && *profile.Debug { + profile.DebugFilters[eIdx].Run(clog, out, exprhelpers.GetExprEnv(map[string]interface{}{"Alert": Alert})) + } if out { matched = true /*the expression matched, create the associated decision*/ @@ -96,9 +100,6 @@ PROFILE_LOOP: decisions = append(decisions, subdecisions...) } else { - if profile.Debug != nil && *profile.Debug { - profile.DebugFilters[eIdx].Run(clog, false, exprhelpers.GetExprEnv(map[string]interface{}{"Alert": Alert})) - } log.Debugf("Profile %s filter is unsuccessful", profile.Name) if profile.OnFailure == "break" { break PROFILE_LOOP