summaryrefslogtreecommitdiff
path: root/lib/chef/application/client.rb
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-10-15 20:41:52 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-10-15 20:41:52 -0700
commite1c6bef68597f5c4f418107ef9e3638e44cc8cf7 (patch)
treec6871e3dcded48265f2b82c26ab13cd62a0ba2be /lib/chef/application/client.rb
parent2da5abd0648f3ba6977d3a69d858078237bee585 (diff)
downloadchef-e1c6bef68597f5c4f418107ef9e3638e44cc8cf7.tar.gz
Add --config-file-jail to avoid loading user knife.rb in tests
Diffstat (limited to 'lib/chef/application/client.rb')
-rw-r--r--lib/chef/application/client.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index ea8d599b4c..0964101fad 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -206,6 +206,10 @@ class Chef::Application::Client < Chef::Application
:long => "--chef-zero-port PORT",
:description => "Port to start chef-zero on"
+ option :config_file_jail,
+ :long => "--config-file-jail PATH",
+ :description => "Directory under which config files are allowed to be loaded (no client.rb or knife.rb outside this path will be loaded)."
+
if Chef::Platform.windows?
option :fatal_windows_admin_check,
:short => "-A",
@@ -272,6 +276,7 @@ class Chef::Application::Client < Chef::Application
end
def load_config_file
+ Chef::Config.config_file_jail = config[:config_file_jail] if config[:config_file_jail]
if !config.has_key?(:config_file)
if config[:local_mode]
require 'chef/knife'