summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKapil Chouhan <kapil.chouhan@msystechnologies.com>2018-11-19 10:00:25 +0000
committerTim Smith <tsmith@chef.io>2018-11-27 17:10:06 -0800
commita268a84e05e2510291c74f0e86f738c502ff3a56 (patch)
tree7009be40f8c9cef75aa56685cc000ab8ccad7f55 /lib
parent852b6eb69e9d11acd32c6d756dfbb9473d97a4ac (diff)
downloadchef-a268a84e05e2510291c74f0e86f738c502ff3a56.tar.gz
Chef client should be fail appropriately when specified package is not applicable to imagecab
Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com>
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