From bb83453de05154b357594c339b56fd37a14b7489 Mon Sep 17 00:00:00 2001 From: dheerajd-msys Date: Thu, 17 Jan 2019 16:15:46 +0530 Subject: update property for existing file Signed-off-by: dheerajd-msys --- lib/chef/resource/openssl_dhparam.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'lib/chef/resource') diff --git a/lib/chef/resource/openssl_dhparam.rb b/lib/chef/resource/openssl_dhparam.rb index ef4fa3d861..b93ad81f55 100644 --- a/lib/chef/resource/openssl_dhparam.rb +++ b/lib/chef/resource/openssl_dhparam.rb @@ -57,17 +57,27 @@ class Chef action :create do description "Create the dhparam file." + unless dhparam_pem_valid?(new_resource.path) + converge_by("Create a dhparam file #{new_resource.path}") do + dhparam_content = gen_dhparam(new_resource.key_length, new_resource.generator).to_pem - converge_by("Create a dhparam file #{new_resource.path}") do - dhparam_content = gen_dhparam(new_resource.key_length, new_resource.generator).to_pem if !::File.exist?(new_resource.path) - + file new_resource.path do + action :create + owner new_resource.owner unless new_resource.owner.nil? + group new_resource.group unless new_resource.group.nil? + mode new_resource.mode + sensitive true + content dhparam_content + end + end + end + if ::File.exist?(new_resource.path) file new_resource.path do action :create owner new_resource.owner unless new_resource.owner.nil? group new_resource.group unless new_resource.group.nil? mode new_resource.mode sensitive true - content dhparam_content end end end -- cgit v1.2.1