summaryrefslogtreecommitdiff
path: root/lib/chef/audit/runner.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-11-05 11:25:05 -0800
committertyler-ball <tyleraball@gmail.com>2014-12-17 18:47:25 -0800
commit5647ffbafcf22cd54b1edc0b02926aca90b9099c (patch)
treeeca29649eb4ab988796d34aa052903b02007d0f0 /lib/chef/audit/runner.rb
parent9f3390ffe26abbe54b51aee19a78cf2778b9b340 (diff)
downloadchef-5647ffbafcf22cd54b1edc0b02926aca90b9099c.tar.gz
Adding first round of formatter integration - STDOUT doc formatter
Diffstat (limited to 'lib/chef/audit/runner.rb')
-rw-r--r--lib/chef/audit/runner.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index 0f439a1aa5..1408c67327 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -17,12 +17,15 @@
#
require 'chef/audit'
+require 'chef/audit/audit_event_proxy'
require 'chef/config'
class Chef
class Audit
class Runner
+ attr_reader :run_context
+
def initialize(run_context)
@run_context = run_context
end
@@ -57,6 +60,8 @@ class Chef
# for people-friendly output of audit results and json for reporting. Also
# configures expectation frameworks.
def setup
+ # We're setting the output stream, but that will only be used for error situations
+ # Our formatter forwards events to the Chef event message bus
configuration.output_stream = Chef::Config[:log_location]
configuration.error_stream = Chef::Config[:log_location]
@@ -66,8 +71,8 @@ class Chef
end
def add_formatters
- configuration.add_formatter(RSpec::Core::Formatters::DocumentationFormatter)
- configuration.add_formatter(ChefJsonFormatter)
+ configuration.add_formatter(Chef::Audit::AuditEventProxy)
+ Chef::Audit::AuditEventProxy.events = run_context.events
end
# Explicitly disable :should syntax.
@@ -92,7 +97,7 @@ class Chef
# Register each controls group with the world, which will handle
# the ordering of the audits that will be run.
def register_controls_groups
- @run_context.controls_groups.each { |ctls_grp| world.register(ctls_grp) }
+ run_context.controls_groups.each { |ctls_grp| world.register(ctls_grp) }
end
end