sous-chefs / certificate

Development repository for the certificate cookbook
https://supermarket.chef.io/cookbooks/certificate
73 stars 43 forks source link

No resource or method named `template' for `Chef::Provider::CertificateManage "none"' #52

Closed jtomaszewski closed 3 years ago

jtomaszewski commented 9 years ago

It has been working correctly for months, and now suddenly it stopped. I wasn't even upgrading any chef or recipes anywhere. Now I'm having this bug and cannot setup the certificate using the manage_by_attributes recipe. I tried reinstalling the recipe, chef - but still it isnt working and I can't fix it.

Any ideas, where's the problem? I tried debugging the certificate cookbook by editing its' source and it really seems like template method would not defined here.

My setup:

configuration of the certificate attribute:

    "certificate": [
      {"myapp": {
          "cert_file": "myapp.pem",
          "key_file": "myapp.key",
          "chain_file": "myapp-bundle.pem",
          "nginx_cert": false
      }}
    ],

Keys are stored properly, encrypted, in data bag certificates/myapp.

Log from running sudo chef-client on the node:

(...)
[2015-08-16T22:31:57+02:00] INFO: Processing certificate_manage[myapp] action create (certificate::manage_by_attributes line 25)

================================================================================
Error executing action `create` on resource 'certificate_manage[myapp]'
================================================================================

NoMethodError
-------------
No resource or method named `template' for `Chef::Provider::CertificateManage "none"'

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/certificate/providers/manage.rb:100:in `cert_file_resource'
/var/chef/cache/cookbooks/certificate/providers/manage.rb:82:in `block in class_from_file'

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/certificate/recipes/manage_by_attributes.rb

 25:     certificate_manage id do
 26:       action :create
 27:       opts.each { |k, v| __send__(k, v) if self.respond_to?(k) } unless opts.nil?
 28:     end
 29:   end

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/certificate/recipes/manage_by_attributes.rb:25:in `block (2 levels) in from_file'

certificate_manage("myapp") do
  action [:create]
  retries 0
  retry_delay 2
  sensitive true
  cookbook_name "certificate"
  recipe_name "manage_by_attributes"
  cert_file "myapp.pem"
  key_file "myapp.key"
  chain_file "myapp-bundle.pem"
  cert_path "/etc/ssl"
  create_subfolders true
  owner "root"
  group "root"
  data_bag_type "encrypted"
  data_bag_secret "/etc/chef/encrypted_data_bag_secret"
  data_bag "certificates"
  search_id "myapp"
  cookbook "certificate"
end

[2015-08-16T22:31:58+02:00] INFO: Running queued delayed notifications before re-raising exception
[2015-08-16T22:31:58+02:00] ERROR: Running exception handlers
[2015-08-16T22:31:58+02:00] ERROR: Exception handlers complete
[2015-08-16T22:31:58+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2015-08-16T22:31:58+02:00] INFO: Sending resource update report (run-id: 62afbf51-39ba-41d1-a6c1-df2612bc89f1)
[2015-08-16T22:31:59+02:00] ERROR: certificate_manage[myapp] (certificate::manage_by_attributes line 25) had an error: NoMethodError: No resource or method named `template' for `Chef::Provider::CertificateManage "none"'
[2015-08-16T22:31:59+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
github-actions[bot] commented 3 years ago

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] commented 3 years ago

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.