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 09:56:22 +0000
commit5afd25ad02a16d9cd4fcc2f9fa6d02d15b3b35cc (patch)
treeb644e26c6be37b67178120c551dba59a3aa21f01
parent0dceab39ad9d6411647c0f14de841091055848d0 (diff)
downloadchef-btm/msu_shellout.tar.gz
Using shell_out! to throw exception if the command fails.btm/msu_shellout
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..149d8ccbe1 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!("#{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..b094c1f2f7 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("#{ENV['SYSTEMROOT']}\\system32\\expand.exe -f:* msu_file destination")
provider.extract_msu_contents("msu_file", "destination")
end
end