fix(userspace/falco): make sure validation summary is populated even when json output is requested

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2022-10-12 09:54:34 +00:00 committed by poiana
parent 9ee0298c4d
commit 9d8f130f47

View File

@ -89,8 +89,7 @@ application::run_result application::validate_rules_files()
{ {
results.push_back(res->as_json(rc)); results.push_back(res->as_json(rc));
} }
else
{
if(summary != "") if(summary != "")
{ {
summary += "\n"; summary += "\n";
@ -98,8 +97,7 @@ application::run_result application::validate_rules_files()
// Add to the summary if not successful, or successful // Add to the summary if not successful, or successful
// with no warnings. // with no warnings.
if(!res->successful() || if(!res->successful() || (res->successful() && !res->has_warnings()))
(res->successful() && !res->has_warnings()))
{ {
summary += res->as_string(true, rc); summary += res->as_string(true, rc);
} }
@ -118,7 +116,6 @@ application::run_result application::validate_rules_files()
} }
} }
} }
}
if(m_state->config->m_json_output) if(m_state->config->m_json_output)
{ {