diff options
-rw-r--r-- | lib/chef/application/solo.rb | 4 | ||||
-rw-r--r-- | spec/unit/application/solo_spec.rb | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index 1228fc4148..f82f727f99 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -214,8 +214,8 @@ class Chef::Application::Solo < Chef::Application FileUtils.mkdir_p(recipes_path) tarball_path = File.join(recipes_path, 'recipes.tgz') fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path) - tarcommand = Mixlib::ShellOut.new("tar zxvf #{tarball_path} -C #{recipes_path}") - tarcommand.run_command + Mixlib::ShellOut.new("tar zxvf #{tarball_path} -C #{recipes_path}").run_command + #tarcommand.run_command end # json_attribs shuld be fetched after recipe_url tarball is unpacked. diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb index 1785ecfc86..cdb20b7435 100644 --- a/spec/unit/application/solo_spec.rb +++ b/spec/unit/application/solo_spec.rb @@ -106,6 +106,8 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config describe "when the recipe_url configuration option is specified" do let(:tarfile) { StringIO.new("remote_tarball_content") } let(:target_file) { StringIO.new } + let(:shellout) { double(run_command: nil, error!: nil, stdout: '') } + before do Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks" @@ -117,7 +119,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config allow(app).to receive(:open).with("http://junglist.gen.nz/recipes.tgz").and_yield(tarfile) allow(File).to receive(:open).with("#{Dir.tmpdir}/chef-solo/recipes.tgz", "wb").and_yield(target_file) - allow(Chef::Mixin::Command).to receive(:run_command).and_return(true) + allow(Mixlib::ShellOut).to receive(:new).and_return(shellout) end it "should create the recipes path based on the parent of the cookbook path" do @@ -136,7 +138,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config end it "should untar the target file to the parent of the cookbook path" do - expect(Chef::Mixin::Command).to receive(:run_command).with({:command => "tar zxvf #{Dir.tmpdir}/chef-solo/recipes.tgz -C #{Dir.tmpdir}/chef-solo"}).and_return(true) + expect(Mixlib::ShellOut).to receive(:new).with("tar zxvf #{Dir.tmpdir}/chef-solo/recipes.tgz -C #{Dir.tmpdir}/chef-solo") app.reconfigure end end |