summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNimishaS <nimisha.sharad@msystechnologies.com>2016-11-18 14:03:34 +0000
committerNimishaS <nimisha.sharad@msystechnologies.com>2016-11-23 13:16:02 +0000
commitae19ad32028f77c14fae16869a63fc19d2d515d2 (patch)
tree53eef87e83e10d77b46a2fa580eed2534decb07e
parent0dceab39ad9d6411647c0f14de841091055848d0 (diff)
downloadchef-ae19ad32028f77c14fae16869a63fc19d2d515d2.tar.gz
Using shell_out_with_timeout! to throw exception if the command fails.
Hardcoded expand.exe path to avoid hitting gnu expand Signed-off-by: NimishaS <nimisha.sharad@msystechnologies.com>
-rw-r--r--lib/chef/provider/package/msu.rb3
-rw-r--r--spec/functional/resource/msu_package_spec.rb2
-rw-r--r--spec/unit/provider/package/msu_spec.rb3
3 files changed, 3 insertions, 5 deletions
diff --git a/lib/chef/provider/package/msu.rb b/lib/chef/provider/package/msu.rb
index e1f0d53a9c..3146ecb04d 100644
--- a/lib/chef/provider/package/msu.rb
+++ b/lib/chef/provider/package/msu.rb
@@ -125,9 +125,8 @@ class Chef
end
def extract_msu_contents(msu_file, destination)
- shellout = Mixlib::ShellOut.new("expand -f:* #{msu_file} #{destination}", { :timeout => @new_resource.timeout })
with_os_architecture(nil) do
- shellout.run_command
+ shell_out_with_timeout!("#{ENV['SYSTEMROOT']}\\system32\\expand.exe -f:* #{msu_file} #{destination}")
end
end
diff --git a/spec/functional/resource/msu_package_spec.rb b/spec/functional/resource/msu_package_spec.rb
index 128eb9dfac..23342be6ae 100644
--- a/spec/functional/resource/msu_package_spec.rb
+++ b/spec/functional/resource/msu_package_spec.rb
@@ -19,7 +19,7 @@
require "spec_helper"
require "chef/provider/package/cab"
-describe Chef::Resource::MsuPackage, :win2012r2_only, :appveyor_only do
+describe Chef::Resource::MsuPackage, :win2012r2_only do
let(:package_name) { "Package_for_KB2959977" }
let(:package_source) { "https://download.microsoft.com/download/3/B/3/3B320C07-B7B1-41E5-81F4-79EBC02DF7D3/Windows8.1-KB2959977-x64.msu" }
diff --git a/spec/unit/provider/package/msu_spec.rb b/spec/unit/provider/package/msu_spec.rb
index d9b97aaee6..26cde5bd5f 100644
--- a/spec/unit/provider/package/msu_spec.rb
+++ b/spec/unit/provider/package/msu_spec.rb
@@ -243,8 +243,7 @@ The operation completed successfully.
describe "#extract_msu_contents" do
it "extracts the msu contents by using mixlib shellout" do
- expect(Mixlib::ShellOut).to receive(:new).with("expand -f:* msu_file destination", { :timeout => new_resource.timeout })
- expect(provider).to receive(:with_os_architecture)
+ expect(provider).to receive(:shell_out_with_timeout!).with("#{ENV['SYSTEMROOT']}\\system32\\expand.exe -f:* msu_file destination")
provider.extract_msu_contents("msu_file", "destination")
end
end