diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-04-30 12:16:39 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-05-01 11:09:49 -0700 |
commit | 92824ed4962d4dfa713a31e2395210781c167b86 (patch) | |
tree | d59b34f4819109ade8d523cf4b69cf105a205d17 /lib/chef/resource_reporter.rb | |
parent | a5f5748653d0ffd90292be2aabfea7783be12f2b (diff) | |
download | chef-92824ed4962d4dfa713a31e2395210781c167b86.tar.gz |
create Chef::Resource#state_for_resource_reporter
Use this to override the state reported by the resource reporter
while avoiding the collision over Chef::Resource#state being used
by some LWRPs.
Diffstat (limited to 'lib/chef/resource_reporter.rb')
-rw-r--r-- | lib/chef/resource_reporter.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb index 1816fc857d..96cc01d814 100644 --- a/lib/chef/resource_reporter.rb +++ b/lib/chef/resource_reporter.rb @@ -62,8 +62,8 @@ class Chef as_hash["type"] = new_resource.class.dsl_name as_hash["name"] = new_resource.name.to_s as_hash["id"] = new_resource.identity.to_s - as_hash["after"] = state(new_resource) - as_hash["before"] = current_resource ? state(current_resource) : {} + as_hash["after"] = new_resource.state_for_resource_reporter + as_hash["before"] = current_resource ? current_resource.state_for_resource_reporter : {} as_hash["duration"] = (elapsed_time * 1000).to_i.to_s as_hash["delta"] = new_resource.diff if new_resource.respond_to?("diff") as_hash["delta"] = "" if as_hash["delta"].nil? @@ -89,13 +89,6 @@ class Chef def success? !self.exception end - - def state(r) - r.class.state_attrs.inject({}) do |state_attrs, attr_name| - state_attrs[attr_name] = r.send(attr_name) - state_attrs - end - end end # End class ResouceReport attr_reader :updated_resources |