Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

No resource, method, or local variable named create_keys' for LWRP resource openssl_x509 #54

Closed
chris-rock opened this issue Mar 21, 2017 · 2 comments

Comments

@chris-rock
Copy link

Cookbook version

0.7.0

Chef-client version

12.5.1

Platform Details

[Operating system distribution and release version. Cloud provider if running in the cloud]

Scenario:

I try to generate certificates with the openssl cookbook

Steps to Reproduce:

openssl_x509 '/etc/httpd/ssl/mycert.pem' do
  common_name 'www.f00bar.com'
  org 'Foo Bar'
  org_unit 'Lab'
  country 'US'
end

This example is from https://github.com/chef-cookbooks/openssl#example-usage-3

Expected Result:

Recipe: os_prepare::x509
  * openssl_x509[/mycert.pem] action create
    - Create openssl_x509[/mycert.pem]
    * file[/mycert.pem] action create_if_missing
      - create new file /mycert.pem
      - update content in file /mycert.pem from none to 01e7ba
      - suppressed sensitive resource
    * file[//mycert.key] action create_if_missing
      - create new file //mycert.key
      - update content in file //mycert.key from none to 7a8c93
      - suppressed sensitive resource
  
  * openssl_rsa_key[/server.key] action create
    - Create an RSA key openssl_rsa_key[/server.key]
    * log[Generating 2048 bit RSA key file at /server.key, this may take some time] action write
    
    * file[/server.key] action create
      - create new file /server.key
      - update content in file /server.key from none to e22864
      - suppressed sensitive resource

Actual Result:

Recipe: os_prepare::x509
  * openssl_x509[/mycert.pem] action create
    
    ================================================================================
    Error executing action `create` on resource 'openssl_x509[/mycert.pem]'
    ================================================================================
    
    NameError
    ---------
    No resource, method, or local variable named `create_keys' for `LWRP resource openssl_x509 from cookbook openssl action provider "/mycert.pem"'
    
    Cookbook Trace:
    ---------------
    /opt/kitchen/cache/cookbooks/openssl/resources/x509.rb:20:in `block (2 levels) in class_from_file'
    /opt/kitchen/cache/cookbooks/openssl/resources/x509.rb:19:in `block in class_from_file'
    /opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
    /opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
    /opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
    /opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
    /opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'
    
    Resource Declaration:
    ---------------------
    # In /opt/kitchen/cache/cookbooks/os_prepare/recipes/x509.rb
    
      3:   openssl_x509 '/mycert.pem' do
      4:     common_name 'www.f00bar.com'
      5:     org 'Foo Bar'
      6:     org_unit 'Lab'
      7:     country 'US'
      8:   end
      9: 
    
    Compiled Resource:
    ------------------
    # Declared in /opt/kitchen/cache/cookbooks/os_prepare/recipes/x509.rb:3:in `from_file'
    
    openssl_x509("/mycert.pem") do
      action [:create]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :openssl_x509
      cookbook_name "os_prepare"
      recipe_name "x509"
      common_name "www.f00bar.com"
      org "Foo Bar"
      org_unit "Lab"
      country "US"
    end

Switching from 7.0.0 to 6.1.1 solved that problem

@tas50
Copy link
Contributor

tas50 commented Mar 21, 2017

Fixed in 7.0.1. I'm pushing the same fix to other cookbooks that have this same problem with the action_class

@tas50 tas50 closed this as completed Mar 21, 2017
@chris-rock
Copy link
Author

Well done @tas50 Switched to the latest version and it works like a charm. Thank you for the quick response!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants