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 <mark.stemm@gmail.com>
This commit is contained in:
Mark Stemm 2022-08-04 14:47:05 -05:00 committed by poiana
parent 2a640daf13
commit fefd23f2f1
2 changed files with 2 additions and 6 deletions

View File

@ -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 ?

View File

@ -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());
}