summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-11-27 09:19:07 -0800
committerGitHub <noreply@github.com>2018-11-27 09:19:07 -0800
commit60eac452f4430ee703841dfa3037274e22d47c87 (patch)
treeffa107e63f676ad2e9cc7bcca6b0658e03e5d43e /lib
parentcfad5b36e65d34145638d3f1b17c848eb90a0215 (diff)
parenta322f0cb65dc0d8f8b7ba5bc25a882df8d5e6023 (diff)
downloadchef-60eac452f4430ee703841dfa3037274e22d47c87.tar.gz
Merge pull request #7951 from MsysTechnologiesllc/Kapil/MSYS-918_Chef_client_should_fail_appropriately_when_specified_package_is_not_applicable_to_image
cab_package: Chef should fail when specified package is not applicable to the image
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/package/cab.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/provider/package/cab.rb b/lib/chef/provider/package/cab.rb
index 79292293d2..cfc629b9ef 100644
--- a/lib/chef/provider/package/cab.rb
+++ b/lib/chef/provider/package/cab.rb
@@ -74,9 +74,13 @@ class Chef
end
def dism_command(command)
- shellout = Mixlib::ShellOut.new("dism.exe /Online /English #{command} /NoRestart", timeout: new_resource.timeout)
with_os_architecture(nil) do
- shellout.run_command
+ result = shell_out("dism.exe /Online /English #{command} /NoRestart", { timeout: new_resource.timeout })
+ if result.exitstatus == -2146498530
+ raise Chef::Exceptions::Package, "The specified package is not applicable to this image." if result.stdout.include?("0x800f081e")
+ result.error!
+ end
+ result
end
end