From 26e4c73790b87dd0f4004c65f99f0c69ede96ee0 Mon Sep 17 00:00:00 2001 From: vasu1105 Date: Thu, 29 Nov 2018 15:03:29 +0530 Subject: MSYS-936 Fix for windows certificate delete action fails if certificate doesn't exist Signed-off-by: vasu1105 --- lib/chef/resource/windows_certificate.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb index 053a67e3e0..0de1fbcfc6 100644 --- a/lib/chef/resource/windows_certificate.rb +++ b/lib/chef/resource/windows_certificate.rb @@ -58,7 +58,6 @@ class Chef action :create do description "Creates or updates a certificate." - add_cert(OpenSSL::X509::Certificate.new(raw_source)) end @@ -90,8 +89,12 @@ class Chef action :delete do description "Deletes a certificate." - - delete_cert + cert_obj = fetch_cert + if cert_obj + converge_by("Deleting certificate #{new_resource.source} from Store #{new_resource.store_name}") do + delete_cert + end + end end action :fetch do -- cgit v1.2.1