summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/knife.rb
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-05-03 11:35:27 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-06-07 13:12:32 -0700
commit001a01373ba9aed7ebec8794a31906ae21140fd6 (patch)
tree016c5532fe40cbc2dbe9e0c98bd443fb6f85d0a2 /lib/chef/chef_fs/knife.rb
parentcf00c1587eadd3d0df5d73e132ce6084c0d35a71 (diff)
downloadchef-001a01373ba9aed7ebec8794a31906ae21140fd6.tar.gz
Add --concurrency argument to set # of threads
Diffstat (limited to 'lib/chef/chef_fs/knife.rb')
-rw-r--r--lib/chef/chef_fs/knife.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 270b6768f5..ec7403539e 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -20,6 +20,7 @@ require 'chef/chef_fs/file_system/chef_server_root_dir'
require 'chef/chef_fs/file_system/chef_repository_file_system_root_dir'
require 'chef/chef_fs/file_pattern'
require 'chef/chef_fs/path_utils'
+require 'chef/chef_fs/parallelizer'
require 'chef/config'
class Chef
@@ -33,11 +34,16 @@ class Chef
option :chef_repo_path,
:long => '--chef-repo-path PATH',
:description => 'Overrides the location of chef repo. Default is specified by chef_repo_path in the config'
+
+ option :concurrency,
+ :long => '--concurrency THREADS',
+ :description => 'Maximum number of simultaneous requests to send (default: 10)'
end
def configure_chef
super
Chef::Config[:repo_mode] = config[:repo_mode] if config[:repo_mode]
+ Chef::Config[:concurrency] = config[:concurrency].to_i if config[:concurrency]
# --chef-repo-path overrides all other paths
path_variables = %w(acl_path client_path cookbook_path container_path data_bag_path environment_path group_path node_path role_path user_path)
@@ -86,6 +92,8 @@ class Chef
end
end
end
+
+ Chef::ChefFS::Parallelizer.threads = (Chef::Config[:concurrency] || 10) - 1
end
def chef_fs