diff options
-rw-r--r-- | lib/chef/application/solo.rb | 2 | ||||
-rw-r--r-- | spec/unit/application/solo_spec.rb | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index 474bbf3f6c..c99170f437 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -191,6 +191,8 @@ class Chef::Application::Solo < Chef::Application cookbooks_path = Array(Chef::Config[:cookbook_path]).detect{|e| e =~ /\/cookbooks\/*$/ } recipes_path = File.expand_path(File.join(cookbooks_path, '..')) + Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it" + FileUtils.rm_rf(recipes_path, :secure => true) Chef::Log.debug "Creating path #{recipes_path} to extract recipes into" FileUtils.mkdir_p(recipes_path) tarball_path = File.join(recipes_path, 'recipes.tgz') diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb index 26d7d34caa..80f0bead8b 100644 --- a/spec/unit/application/solo_spec.rb +++ b/spec/unit/application/solo_spec.rb @@ -94,6 +94,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config before do Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks" Chef::Config[:recipe_url] = "http://junglist.gen.nz/recipes.tgz" + allow(FileUtils).to receive(:rm_rf).and_return(true) allow(FileUtils).to receive(:mkdir_p).and_return(true) @tarfile = StringIO.new("remote_tarball_content") allow(@app).to receive(:open).with("http://junglist.gen.nz/recipes.tgz").and_yield(@tarfile) @@ -135,6 +136,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config Chef::Config[:json_attribs] = json_source Chef::Config[:recipe_url] = "http://icanhas.cheezburger.com/lolcats" Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks" + allow(FileUtils).to receive(:rm_rf).and_return(true) allow(FileUtils).to receive(:mkdir_p).and_return(true) allow(Chef::Mixin::Command).to receive(:run_command).and_return(true) end |