diff options
author | John Keiser <jkeiser@opscode.com> | 2013-10-09 16:59:38 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-10-09 16:59:38 -0700 |
commit | 2a214bcff7174b61129a7a8a642b8df5b5f4afee (patch) | |
tree | 5b04e9e034fa209a54575b4df24f1fac0661fe78 /lib/chef/knife.rb | |
parent | f9521c3aaa6aaa42f94bbf81b260797da199f6a9 (diff) | |
download | chef-2a214bcff7174b61129a7a8a642b8df5b5f4afee.tar.gz |
Pick up knife config instead of /etc/chef/client.rb if local mode is specified
Diffstat (limited to 'lib/chef/knife.rb')
-rw-r--r-- | lib/chef/knife.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index 86dac79603..5ff6b92643 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -314,7 +314,7 @@ class Chef config_file_settings end - def locate_config_file + def self.locate_config_file candidate_configs = [] # Look for $KNIFE_HOME/knife.rb (allow multiple knives config on same machine) @@ -326,8 +326,8 @@ class Chef candidate_configs << File.join(Dir.pwd, 'knife.rb') end # Look for $UPWARD/.chef/knife.rb - if self.class.chef_config_dir - candidate_configs << File.join(self.class.chef_config_dir, 'knife.rb') + if chef_config_dir + candidate_configs << File.join(chef_config_dir, 'knife.rb') end # Look for $HOME/.chef/knife.rb if ENV['HOME'] @@ -337,10 +337,10 @@ class Chef candidate_configs.each do | candidate_config | candidate_config = File.expand_path(candidate_config) if File.exist?(candidate_config) - config[:config_file] = candidate_config - break + return candidate_config end end + return nil end # Apply Config in this order: @@ -404,7 +404,8 @@ class Chef def configure_chef unless config[:config_file] - locate_config_file + located_config_file = self.class.locate_config_file + config[:config_file] = located_config_file if located_config_file end # Don't try to load a knife.rb if it doesn't exist. |