summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-05-21 10:25:32 -0700
committerClaire McQuin <claire@getchef.com>2014-05-22 12:16:36 -0700
commit08f3547a39cb2390425587860208513cba9eab3f (patch)
treedd44955acded66d3646671d7d21ce9ba3b11e039
parent7d2891419ef04288ddd7bb2322df41cc9bd203dd (diff)
downloadchef-08f3547a39cb2390425587860208513cba9eab3f.tar.gz
change backup cache location to user's .chef
-rw-r--r--lib/chef/config.rb2
-rw-r--r--spec/unit/config_spec.rb12
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb
index fcab13ca5e..8c6aec0d34 100644
--- a/lib/chef/config.rb
+++ b/lib/chef/config.rb
@@ -247,7 +247,7 @@ class Chef
# Otherwise, we'll create .chef.d under the user's home directory and use that as
# the cache path.
unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
- secondary_cache_path = File.join(user_home, '.chef.d')
+ secondary_cache_path = File.join(user_home, '.chef')
secondary_cache_path.gsub!(File::SEPARATOR, platform_path_separator) # Safety, mainly for Windows...
Chef::Log.warn("Unable to access cache at #{primary_cache_path}. Switching cache to #{secondary_cache_path}")
secondary_cache_path
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index d1449e221e..779f97ab9e 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -148,17 +148,17 @@ describe Chef::Config do
def secondary_cache_path
if windows?
- "#{Chef::Config.env['SYSTEMDRIVE']}\\#{Chef::Config.env['HOMEPATH']}\\.chef.d"
+ "#{Chef::Config.env['SYSTEMDRIVE']}\\#{Chef::Config.env['HOMEPATH']}\\.chef"
else
- "#{Chef::Config.env['HOME']}/.chef.d"
+ "#{Chef::Config.env['HOME']}/.chef"
end
end
before do
if windows?
- Chef::Config.stub(:env).and_return({'SYSTEMDRIVE' => "C:", 'HOMEPATH' => "MyHome"})
+ Chef::Config.stub(:env).and_return({'SYSTEMDRIVE' => "C:", 'HOMEPATH' => "KittenHome"})
else
- Chef::Config.stub(:env).and_return({'HOME' => "/Users/me"})
+ Chef::Config.stub(:env).and_return({'HOME' => "/Users/kitten"})
end
Chef::Config.stub(:path_accessible?).and_return(false)
@@ -181,7 +181,7 @@ describe Chef::Config do
end
context "when /var/chef does not exist and /var is not accessible" do
- it "defaults to $HOME/.chef.d" do
+ it "defaults to $HOME/.chef" do
File.stub(:exists?).with(Chef::Config.platform_specific_path("/var/chef")).and_return(false)
Chef::Config.stub(:path_accessible?).with(Chef::Config.platform_specific_path("/var")).and_return(false)
Chef::Config[:cache_path].should == secondary_cache_path
@@ -189,7 +189,7 @@ describe Chef::Config do
end
context "when /var/chef exists and is not accessible" do
- it "defaults to $HOME/.chef.d" do
+ it "defaults to $HOME/.chef" do
File.stub(:exists?).with(Chef::Config.platform_specific_path("/var/chef")).and_return(true)
File.stub(:readable?).with(Chef::Config.platform_specific_path("/var/chef")).and_return(true)
File.stub(:writable?).with(Chef::Config.platform_specific_path("/var/chef")).and_return(false)