diff options
author | Milan Stastny <milan@stastnej.ch> | 2021-01-26 21:33:51 +0100 |
---|---|---|
committer | Milan Stastny <milan@stastnej.ch> | 2021-01-26 21:44:00 +0100 |
commit | ec99408a1db7553bf1739fd80f8e21faf7a5f27c (patch) | |
tree | e1f1a74f9d63d1baeb1448afec828bba6799d421 | |
parent | 03270d203dae0ea3ee5309f12e4d5079f7e543d2 (diff) | |
download | chef-ec99408a1db7553bf1739fd80f8e21faf7a5f27c.tar.gz |
Fix format
Signed-off-by: Milan Stastny <mistastn@cisco.com>
-rw-r--r-- | lib/chef/compliance/reporter/cli.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/chef/compliance/reporter/cli.rb b/lib/chef/compliance/reporter/cli.rb index c0908ebc34..126c70e752 100644 --- a/lib/chef/compliance/reporter/cli.rb +++ b/lib/chef/compliance/reporter/cli.rb @@ -4,16 +4,15 @@ class Chef class Cli def send_report(report) # iterate over each profile and control - output = [] + output = ["\nCompliance report:"] report[:profiles].each do |profile| next if profile[:controls].nil? - output << "\n" - output << profile[:title] + output << " * #{profile[:title]}" profile[:controls].each do |control| next if control[:results].nil? - output << "\t#{control[:title]}" + output << " #{control[:title]}" control[:results].each do |result| output << format_result(result) end @@ -31,33 +30,33 @@ class Chef if result[:status] == 'failed' if result[:code_desc] found = true - output << "\t\t\033[31m\xE2\x9D\x8C #{result[:code_desc]}\033[0m" + output << " \033[31m\xE2\x9D\x8C #{result[:code_desc]}\033[0m" end if result[:message] if found result[:message].split(/\n/).reject(&:empty?).each do |m| - output << "\t\t\t\033[31m#{m}\033[0m" + output << " \033[31m#{m}\033[0m" end else prefix = "\xE2\x9D\x8C" result[:message].split(/\n/).reject(&:empty?).each do |m| - output << "\t\t\033[31m#{prefix}#{m}\033[0m" + output << " \033[31m#{prefix}#{m}\033[0m" prefix = '' end end found = true end unless found - output << "\t\t\033[31m\xE2\x9D\x8C #{result[:status]}\033[0m" + output << " \033[31m\xE2\x9D\x8C #{result[:status]}\033[0m" end else found = false if result[:code_desc] found = true - output << "\t\t\033[32m\xE2\x9C\x94 #{result[:code_desc]}\033[0m" + output << " \033[32m\xE2\x9C\x94 #{result[:code_desc]}\033[0m" end unless found - output << "\t\t\033[32m\xE2\x9C\x94 #{result[:status]}\033[0m" + output << " \033[32m\xE2\x9C\x94 #{result[:status]}\033[0m" end end output |