diff options
author | tyler-ball <tyleraball@gmail.com> | 2014-12-02 16:09:35 -0800 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2014-12-17 18:52:21 -0800 |
commit | b079e015f4ebb8c5db600bd49641699cbbacdb10 (patch) | |
tree | fd7d81f983998b228aa8e63875f03c895716fa7a /lib/chef/dsl/audit.rb | |
parent | 19f2c6e437642db0c03b193349b13d04636cb8ee (diff) | |
download | chef-b079e015f4ebb8c5db600bd49641699cbbacdb10.tar.gz |
Adding cookbook and recipe information per analytics request
Diffstat (limited to 'lib/chef/dsl/audit.rb')
-rw-r--r-- | lib/chef/dsl/audit.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/dsl/audit.rb b/lib/chef/dsl/audit.rb index a261d38f33..022bbcce01 100644 --- a/lib/chef/dsl/audit.rb +++ b/lib/chef/dsl/audit.rb @@ -34,7 +34,16 @@ class Chef raise Chef::Exceptions::AuditControlGroupDuplicate.new(name) end - run_context.audits[name] = { :args => args, :block => block } + # This DSL will only work in the Recipe class because that exposes the cookbook_name + cookbook_name = self.cookbook_name + metadata = { + cookbook_name: cookbook_name, + cookbook_version: self.run_context.cookbook_collection[cookbook_name].version, + recipe_name: self.recipe_name, + line_number: block.source_location[1] + } + + run_context.audits[name] = Struct.new(:args, :block, :metadata).new(args, block, metadata) end end |