diff options
author | sersut <serdar@opscode.com> | 2013-10-21 16:14:28 -0700 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-10-21 16:14:28 -0700 |
commit | 7ef1019839b03c182aed3215675c2f1169174677 (patch) | |
tree | 996d1f28e343518c324dbc2d7068debf8043fb97 | |
parent | 4924d9133801c2b6e6b25312171b06b61668f192 (diff) | |
parent | 5743710e8c2d1a96bcf20657cf88e8f0c96fccdb (diff) | |
download | chef-7ef1019839b03c182aed3215675c2f1169174677.tar.gz |
Merge branch '11-stable' of github.com:opscode/chef into 11-stable
-rw-r--r-- | lib/chef/config.rb | 17 | ||||
-rw-r--r-- | spec/unit/config_spec.rb | 10 |
2 files changed, 15 insertions, 12 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb index f8148d939e..082c00c767 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -23,6 +23,7 @@ require 'chef/log' require 'chef/exceptions' require 'mixlib/config' require 'chef/util/selinux' +require 'pathname' class Chef class Config @@ -519,17 +520,13 @@ class Chef # "embedded" directory which contains all of the software packaged with # omnibus. This is used to locate the cacert.pem file on windows. def self.embedded_dir - find_embedded_dir_in(_this_file) - end - - def self.find_embedded_dir_in(path) - if File.basename(path) == "embedded" - path - elsif File.basename(path) == path - nil - else - find_embedded_dir_in(File.dirname(path)) + Pathname.new(_this_file).ascend do |path| + if path.basename.to_s == "embedded" + return path.to_s + end end + + nil end # Path to this file in the current install. diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 3771b853a1..0a246037fb 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -183,8 +183,14 @@ describe Chef::Config do Chef::Config[:ssl_ca_path].should be_nil end - it "Chef::Config[:ssl_ca_file] defaults to nil" do - Chef::Config[:ssl_ca_file].should be_nil + describe "when on UNIX" do + before do + Chef::Config.stub(:on_windows?).and_return(false) + end + + it "Chef::Config[:ssl_ca_file] defaults to nil" do + Chef::Config[:ssl_ca_file].should be_nil + end end it "Chef::Config[:data_bag_path] defaults to /var/chef/data_bags" do |