diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-16 14:40:40 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-16 14:40:40 -0700 |
commit | 619a3d40eb6e0aa1627f5cafbc25245a7eef447f (patch) | |
tree | 0b121794fbb6c16e0c908f945a6649abc2671d8d /lib/chef/node/attribute.rb | |
parent | 1f23881a95d1dfa63158c7c35d3f8723df97a758 (diff) | |
download | chef-lcg/debub-value-arrays.tar.gz |
fix node#debug_value access through arrayslcg/debub-value-arrays
nod to @jaymzh for finding this one.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/node/attribute.rb')
-rw-r--r-- | lib/chef/node/attribute.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 761694e010..57d1b0a4d3 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -216,16 +216,12 @@ class Chef # that precedence level, +value+ will be the symbol +:not_present+. def debug_value(*args) COMPONENTS.map do |component| - ivar = instance_variable_get(component) - value = args.inject(ivar) do |so_far, key| - if so_far == :not_present - :not_present - elsif so_far.has_key?(key) - so_far[key] - else + value = + begin + instance_variable_get(component).read!(*args) + rescue :not_present end - end [component.to_s.sub(/^@/, ""), value] end end |