summaryrefslogtreecommitdiff
path: root/lib/chef/knife/core/generic_presenter.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2015-02-11 07:51:07 -0800
committertyler-ball <tyleraball@gmail.com>2015-02-11 15:17:13 -0800
commit29554013c62ee754e426f7a63a38ed62e10a6f2b (patch)
tree70832fd2e4f549221fe5ece58fede40083a3ca8a /lib/chef/knife/core/generic_presenter.rb
parent68bab0b362c47e5a75492e57094f72ecee1171ae (diff)
downloadchef-29554013c62ee754e426f7a63a38ed62e10a6f2b.tar.gz
Finishing tests for https://github.com/chef/chef/pull/2338, fixes https://github.com/chef/chef/issues/1974tball/complete-2338
Diffstat (limited to 'lib/chef/knife/core/generic_presenter.rb')
-rw-r--r--lib/chef/knife/core/generic_presenter.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index a1aeadb0f3..f3ea0f0d6c 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -178,10 +178,13 @@ class Chef
nested_value_spec.split(".").each do |attr|
if data.nil?
nil # don't get no method error on nil
- elsif data.respond_to?(attr.to_sym)
- data = data.send(attr.to_sym)
+ # Must check :[] before attr because spec can include
+ # `keys` - want the key named `keys`, not a list of
+ # available keys.
elsif data.respond_to?(:[])
data = data[attr]
+ elsif data.respond_to?(attr.to_sym)
+ data = data.send(attr.to_sym)
else
data = begin
data.send(attr.to_sym)