diff options
author | John Keiser <john@johnkeiser.com> | 2015-12-02 18:07:51 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-12-02 18:07:51 -0800 |
commit | 2a610564a8a42208adf2158a7c5c0657b243d58a (patch) | |
tree | 3d8c709dc70407f1aadd98b10060b79626b72976 /lib/chef | |
parent | 3d7440aae2f78f99d63ed4a24b5b1f3c5b1da8a8 (diff) | |
parent | 0c5ef9442d6fe8be5a9d0eb5d50ace124adeffd5 (diff) | |
download | chef-2a610564a8a42208adf2158a7c5c0657b243d58a.tar.gz |
Merge branch 'jk/4127'
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/resource.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 90453bd00e..3edcc24e17 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -664,13 +664,18 @@ class Chef end def to_hash + # Grab all current state, then any other ivars (backcompat) + result = {} + self.class.state_properties.each do |p| + result[p.name] = p.get(self) + end safe_ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS - instance_vars = Hash.new safe_ivars.each do |iv| key = iv.to_s.sub(/^@/,'').to_sym - instance_vars[key] = instance_variable_get(iv) + next if result.has_key?(key) + result[key] = instance_variable_get(iv) end - instance_vars + result end def self.json_create(o) |