mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-14 06:54:46 +00:00
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:
parent
9ee0298c4d
commit
9d8f130f47
@ -89,33 +89,30 @@ application::run_result application::validate_rules_files()
|
|||||||
{
|
{
|
||||||
results.push_back(res->as_json(rc));
|
results.push_back(res->as_json(rc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(summary != "")
|
||||||
|
{
|
||||||
|
summary += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the summary if not successful, or successful
|
||||||
|
// with no warnings.
|
||||||
|
if(!res->successful() || (res->successful() && !res->has_warnings()))
|
||||||
|
{
|
||||||
|
summary += res->as_string(true, rc);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(summary != "")
|
// If here, there must be only warnings.
|
||||||
{
|
// Add a line to the summary noting that the
|
||||||
summary += "\n";
|
// file was ok with warnings, without actually
|
||||||
}
|
// printing the warnings.
|
||||||
|
summary += filename + ": Ok, with warnings";
|
||||||
|
|
||||||
// Add to the summary if not successful, or successful
|
// If verbose is true, print the warnings now.
|
||||||
// with no warnings.
|
if(m_options.verbose)
|
||||||
if(!res->successful() ||
|
|
||||||
(res->successful() && !res->has_warnings()))
|
|
||||||
{
|
{
|
||||||
summary += res->as_string(true, rc);
|
fprintf(stderr, "%s\n", res->as_string(true, rc).c_str());
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If here, there must be only warnings.
|
|
||||||
// Add a line to the summary noting that the
|
|
||||||
// file was ok with warnings, without actually
|
|
||||||
// printing the warnings.
|
|
||||||
summary += filename + ": Ok, with warnings";
|
|
||||||
|
|
||||||
// If verbose is true, print the warnings now.
|
|
||||||
if(m_options.verbose)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s\n", res->as_string(true, rc).c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user