diff options
-rw-r--r-- | lib/chef/audit.rb | 1 | ||||
-rw-r--r-- | lib/chef/audit/chef_json_formatter.rb | 2 | ||||
-rw-r--r-- | lib/chef/client.rb | 4 | ||||
-rw-r--r-- | lib/chef/dsl/audit.rb | 5 | ||||
-rw-r--r-- | lib/chef/run_context.rb | 3 |
5 files changed, 9 insertions, 6 deletions
diff --git a/lib/chef/audit.rb b/lib/chef/audit.rb index 1e3668396f..43d5c11ee8 100644 --- a/lib/chef/audit.rb +++ b/lib/chef/audit.rb @@ -20,3 +20,4 @@ require 'rspec/core' require 'chef/dsl/audit' require 'chef/audit/chef_json_formatter' +require 'chef/audit/runner' diff --git a/lib/chef/audit/chef_json_formatter.rb b/lib/chef/audit/chef_json_formatter.rb index 3c164120b4..5dcbdb50b7 100644 --- a/lib/chef/audit/chef_json_formatter.rb +++ b/lib/chef/audit/chef_json_formatter.rb @@ -1,5 +1,5 @@ RSpec::Support.require_rspec_core "formatters/base_formatter" -require 'control_group_data' +require 'chef/audit/control_group_data' require 'ffi_yajl' class Chef diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 6c83639ec3..3818f9fad6 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -25,6 +25,7 @@ require 'chef/log' require 'chef/rest' require 'chef/api_client' require 'chef/api_client/registration' +require 'chef/audit' require 'chef/node' require 'chef/role' require 'chef/file_cache' @@ -344,7 +345,8 @@ class Chef audit_exception = nil begin @events.audit_start(run_context) - # TODO + auditor = Chef::Audit::Runner.new(run_context) + auditor.run @events.audit_complete rescue Exception => e @events.audit_failed(e) diff --git a/lib/chef/dsl/audit.rb b/lib/chef/dsl/audit.rb index 7adcecbf14..948db72921 100644 --- a/lib/chef/dsl/audit.rb +++ b/lib/chef/dsl/audit.rb @@ -27,12 +27,9 @@ class Chef raise ::Chef::Exceptions::NoAuditsProvided unless group_block # TODO add the @example_groups list to the runner for later execution - # run_context.audit_runner.register - ::Chef::Audit::ChefExampleGroup.describe(group_name, &group_block) + run_context.controls_groups << ::Chef::Audit::ChefExampleGroup.describe(group_name, &group_block) end end end end - - diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index 18d353ac61..bdf1cf3d3a 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -51,6 +51,8 @@ class Chef # recipes, which is triggered by #load. (See also: CookbookCompiler) attr_accessor :resource_collection + attr_accessor :controls_groups + # Chef::ProviderResolver for this run attr_accessor :provider_resolver @@ -77,6 +79,7 @@ class Chef @node = node @cookbook_collection = cookbook_collection @resource_collection = Chef::ResourceCollection.new + @controls_groups = [] @immediate_notification_collection = Hash.new {|h,k| h[k] = []} @delayed_notification_collection = Hash.new {|h,k| h[k] = []} @definitions = Hash.new |