class Risu::Templates::FailedAudits
Public Class Methods
new()
click to toggle source
Initializes the template loading meta data
# File lib/risu/templates/failed_audits.rb, line 28 def initialize @template_info = { :name => "failed_audits", :author => "abenson", :version => "0.0.2", :renderer => "PDF", :description => "Failed Audit Checks" } end
Public Instance Methods
print_header(size, text, color)
click to toggle source
# File lib/risu/templates/failed_audits.rb, line 39 def print_header(size, text, color) oldcolor = @output.fill_color @output.font_size(size) do @output.fill_color color @output.text text, :style => :bold @output.fill_color oldcolor end end
render(output)
click to toggle source
Called during the rendering process
# File lib/risu/templates/failed_audits.rb, line 50 def render output text Report.classification.upcase, :align => :center text "\n" report_title Report.title report_subtitle "Failed Audit Checks" report_author "This report was prepared by\n#{Report.author}" text "\n\n\n" text "Verify each finding. The compliance audits only look for exact matches. For example, if the policy value for minimum password length is 8, and the actual value is 10, this finding can be ignored." text "\n\n\n" Host.all.each do |h| print_header(20, "#{h.name} (#{h.ip})", "000000") if h.items.where(:cm_compliance_result => "FAILED").count > 0 data = [["Name", "Policy", "Value"]] h.items.where(:cm_compliance_result => "FAILED").each do |cm| data += [[cm.cm_compliance_check_name, cm.cm_compliance_policy_value, cm.cm_compliance_actual_value]] end output.table(data, :header => true) do row(0).style(:font_style => :bold, :background_color => 'D0D0D0') cells.borders = [:top, :bottom, :left, :right] end text "\n" elsif h.items.where(:cm_compliance_result => "PASSED").count > 0 text "Host passed all audits." else text "Audits were not conducted on host." end end text "\n\n\n" output.start_new_page end