diff options
author | Bryan McLellan <btm@opscode.com> | 2012-10-11 12:07:05 -0700 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2012-10-11 12:07:05 -0700 |
commit | bc98c582bb479554682577022368ded0e71f2fce (patch) | |
tree | 52756c3b4753bac295a131cdd325414e60659d4e | |
parent | 9de5dc24bb340752f12471e04c5f1404418030da (diff) | |
download | chef-bc98c582bb479554682577022368ded0e71f2fce.tar.gz |
CHEF-3484: skip item if lacking the specified attribute
Sometimes we get a good node object but it lacks the attribute that we
specified to use to connect to the node, so we should skip that too
-rw-r--r-- | chef/lib/chef/knife/ssh.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/chef/lib/chef/knife/ssh.rb b/chef/lib/chef/knife/ssh.rb index c210d158f5..26031b14e4 100644 --- a/chef/lib/chef/knife/ssh.rb +++ b/chef/lib/chef/knife/ssh.rb @@ -125,7 +125,7 @@ class Chef @action_nodes = q.search(:node, @name_args[0])[0] @action_nodes.each do |item| # we should skip the loop to next iteration if the item returned by the search is nil - next if item.nil? + next if item.nil? # if a command line attribute was not passed, and we have a cloud public_hostname, use that. # see #configure_attribute for the source of config[:attribute] and config[:override_attribute] if !config[:override_attribute] && item[:cloud] and item[:cloud][:public_hostname] @@ -135,7 +135,8 @@ class Chef else i = format_for_display(item)[config[:attribute]] end - # we no longer need a check for nil as we are skipping nil items + # next if we couldn't find the specified attribute in the returned node object + next if i.nil? r.push(i) end r |