summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2019-02-21 15:46:49 -0500
committerTim Smith <tsmith@chef.io>2019-03-04 09:46:52 -0800
commit9d90ac18db6b868d4ff96a6cd10ff32f51adc48b (patch)
tree9fa8e977b75959841246cdb7dc5cba1a468ed40b
parent12ad5791dfca9a0eb05f093e9cf2c8f70c73cdbd (diff)
downloadchef-9d90ac18db6b868d4ff96a6cd10ff32f51adc48b.tar.gz
Simplify openssl_dhparam mode fix
Reduce this down to a single file resource Signed-off-by: Bryan McLellan <btm@loftninjas.org>
-rw-r--r--lib/chef/resource/openssl_dhparam.rb31
1 files changed, 11 insertions, 20 deletions
diff --git a/lib/chef/resource/openssl_dhparam.rb b/lib/chef/resource/openssl_dhparam.rb
index 581ac8f3b7..f0e82ebfd4 100644
--- a/lib/chef/resource/openssl_dhparam.rb
+++ b/lib/chef/resource/openssl_dhparam.rb
@@ -57,28 +57,19 @@ class Chef
action :create do
description "Create the dhparam file."
+ dhparam_content = nil
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
-
- 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
+ dhparam_content = gen_dhparam(new_resource.key_length, new_resource.generator).to_pem
+ Chef::Log.debug("Valid dhparam content not found at #{new_resource.path}, creating new")
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
- end
+
+ file new_resource.path do
+ action :create
+ owner new_resource.owner
+ group new_resource.group
+ mode new_resource.mode
+ sensitive true
+ content dhparam_content
end
end
end