Better error handling in sys_x509_certificate
sys_x509_certificate does not handle gracefully when the chef-vault
gem is not available but will abort with a confusing error message:
sys_x509_certificate[…] action install[2023-02-03T18:26:36+01:00] INFO: Processing sys_x509_certificate[…] action install (sys::ssl line 46)
================================================================================
Error executing action `install` on resource 'sys_x509_certificate[…]'
================================================================================
NameError
---------
uninitialized constant Custom resource sys_x509_certificate from cookbook sys::ChefVault
Cookbook Trace:
---------------
/var/cache/chef/cookbooks/sys/resources/x509_certificate.rb:86:in `rescue in block in class_from_file'
/var/cache/chef/cookbooks/sys/resources/x509_certificate.rb:78:in `block in class_from_file'
key_file_content
in resources/x509_certificate.rb
should either explicitly require 'chef-vault'
or catch NameError
s and abort gracefully or skip the installation of the key with an error message.