summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKapil Chouhan <kapil.chouhan@msystechnologies.com>2018-11-19 10:00:25 +0000
committerKapil Chouhan <kapil.chouhan@msystechnologies.com>2018-11-27 08:33:39 +0000
commita322f0cb65dc0d8f8b7ba5bc25a882df8d5e6023 (patch)
treed71bb7adfcdef1a8a41915656611583dc1eccc11 /lib
parenta97e5da2e9dc3218da8df80eb905013effc85ca9 (diff)
downloadchef-a322f0cb65dc0d8f8b7ba5bc25a882df8d5e6023.tar.gz
Chef client should be fail appropriately when specified package is not applicable to image
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