diff options
author | Bryan McLellan <btm@loftninjas.org> | 2019-02-21 15:46:49 -0500 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2019-02-21 18:15:12 -0500 |
commit | 5b22f658d1415089c9b2ab3ac8722add77a946fe (patch) | |
tree | 8437a796351a787b0ac8634aee688ac8d217a598 /lib/chef/resource | |
parent | bb83453de05154b357594c339b56fd37a14b7489 (diff) | |
download | chef-5b22f658d1415089c9b2ab3ac8722add77a946fe.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>
Diffstat (limited to 'lib/chef/resource')
-rw-r--r-- | lib/chef/resource/openssl_dhparam.rb | 31 |
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 |