# File lib/chef/knife/ssh.rb, line 133
      def configure_session
        list = case config[:manual]
               when true
                 @name_args[0].split(" ")
               when false
                 r = Array.new
                 q = Chef::Search::Query.new
                 @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? 
                   # 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]
                     i = item[:cloud][:public_hostname]
                   elsif config[:override_attribute]
                     i = format_for_display(item)[config[:override_attribute]]
                   else
                     i = format_for_display(item)[config[:attribute]]
                   end
                   # next if we couldn't find the specified attribute in the returned node object
                   next if i.nil?
                   r.push(i)
                 end
                 r
               end
        if list.length == 0
          if @action_nodes.length == 0
            ui.fatal("No nodes returned from search!")
          else
            ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes":"node"} found, " +
                     "but does not have the required attribute to establish the connection. " +
                     "Try setting another attribute to open the connection using --attribute.")
          end
          exit 10
        end
        session_from_list(list)
      end