From fefd23f2f1316dcffd74239168f2e19bda78e428 Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Thu, 4 Aug 2022 14:47:05 -0500 Subject: [PATCH] fix: print full rule load errors without verbose/-v The latest released falco always prints full details on errors when used with -r (read rules)/-V (validate rules). However #2098 changed this to only print full details when verbose is true. Fix the regression by always printing errors when loading rules. Warnings will be printed only with -v. Signed-off-by: Mark Stemm --- userspace/falco/app_actions/load_rules_files.cpp | 4 +--- userspace/falco/app_actions/validate_rules_files.cpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/userspace/falco/app_actions/load_rules_files.cpp b/userspace/falco/app_actions/load_rules_files.cpp index cbec79c1..deba30ef 100644 --- a/userspace/falco/app_actions/load_rules_files.cpp +++ b/userspace/falco/app_actions/load_rules_files.cpp @@ -100,9 +100,7 @@ application::run_result application::load_rules_files() res = m_state->engine->load_rules_file(filename); - // Print the full output if verbose is true - if(m_options.verbose && - (!res->successful() || res->has_warnings())) + if((!res->successful() || (m_options.verbose && res->has_warnings()))) { printf("%s\n", (m_state->config->m_json_output ? diff --git a/userspace/falco/app_actions/validate_rules_files.cpp b/userspace/falco/app_actions/validate_rules_files.cpp index c812662b..cab4dfb5 100644 --- a/userspace/falco/app_actions/validate_rules_files.cpp +++ b/userspace/falco/app_actions/validate_rules_files.cpp @@ -56,9 +56,7 @@ application::run_result application::validate_rules_files() } else { - // Print the full output when verbose is true - if(m_options.verbose && - (!res->successful() || res->has_warnings())) + if(!res->successful() || (m_options.verbose && res->has_warnings())) { printf("%s\n", res->as_string(true).c_str()); }