summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2019-02-21 15:46:49 -0500
committerBryan McLellan <btm@loftninjas.org>2019-02-21 18:15:12 -0500
commit5b22f658d1415089c9b2ab3ac8722add77a946fe (patch)
tree8437a796351a787b0ac8634aee688ac8d217a598
parentbb83453de05154b357594c339b56fd37a14b7489 (diff)
downloadchef-btm/MSYS-955_openssl_dhparam_mode_fix.tar.gz
Simplify openssl_dhparam mode fixbtm/MSYS-955_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 b93ad81f55..05347ec494 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