summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Cragun <me@ryan.ec>2015-01-28 16:07:57 -0800
committerRyan Cragun <me@ryan.ec>2015-01-28 16:07:57 -0800
commitab3031b3381fa42e73c8375b1925d3bbdd7938bf (patch)
tree67e17c99e1c37f5267eacb1cc655e78461f81868
parent194f49bdb7737e0591271ba95021997e90379c5d (diff)
downloadchef-ryan/knife_ssh_row.tar.gz
Add row support to knife ssh searchryan/knife_ssh_row
-rw-r--r--lib/chef/knife/ssh.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index de4c60d998..3681fbbb17 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -103,6 +103,13 @@ class Chef
:boolean => true,
:default => true
+ option :rows,
+ :short => "-R INT",
+ :long => "--rows INT",
+ :description => "The maximum number of rows to return in node search",
+ :default => 1000,
+ :proc => lambda { |i| i.to_i }
+
def session
config[:on_error] ||= :skip
ssh_error_handler = Proc.new do |server|
@@ -155,7 +162,9 @@ class Chef
def search_nodes
list = Array.new
query = Chef::Search::Query.new
- @action_nodes = query.search(:node, @name_args[0])[0]
+ search_args = Hash.new
+ search_args[:rows] = config[:rows]
+ @action_nodes = query.search(:node, @name_args[0], search_args)[0]
@action_nodes.each do |item|
# we should skip the loop to next iteration if the item
# returned by the search is nil