sous-chefs / openvpn

Development repository for the openvpn cookbook
https://supermarket.chef.io/cookbooks/openvpn
Apache License 2.0
98 stars 160 forks source link

undefined method `proto' for Custom resource openvpn_conf from cookbook openvpn #125

Closed cbanciu667 closed 6 years ago

cbanciu667 commented 6 years ago

Cookbook version

[Version of the cookbook where you are encountering the issue] 3.0.0

Chef-client version

[Version of chef-client in your environment] 13.9.1

Platform Details

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

Scenario:

[What you are trying to achieve and you can't?] use the opnvpn_conf resource

Steps to Reproduce:

[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?]

  1. define resource like: openvpn_conf 'server' do port node['openvpn']['config']['port'] proto node['openvpn']['config']['proto'] type node['openvpn']['config']['dev'] local node['openvpn']['config']['local'] routes node['openvpn']['routes'] script_security node['openvpn']['script_security'] key_dir node['openvpn']['key_dir'] key_size node['openvpn']['key']['size'] subnet node['openvpn']['subnet'] netmask node['openvpn']['netmask'] user node['openvpn']['user'] group node['openvpn']['group'] log node['openvpn']['log'] not_if { node['openvpn']['configure_default_server'] } action :create notifies :restart, 'service[openvpn]' end

  2. chef converge

Expected Result:

[What are you expecting to happen as the consequence of above reproduction steps?] succesful converge and conf file creation

Actual Result:

[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.] getting error messages like this for every resource property: [2018-05-11T23:54:23+00:00] ERROR: undefined method `proto' for Custom resource openvpn_conf from cookbook openvpn

with 2.1.0 is working

josephholsten commented 6 years ago

I’m sorry this is surprising to you, but that resource has been completely rewritten since 2.x. Instead, conf now has an all-powerful config property: https://github.com/sous-chefs/openvpn/blob/master/resources/conf.rb. The reason being: we didn’t actually get any benefit from the fine grained properties, and supporting the entire possible values in the Openvpn config the cookbook have much more code than needed for this approach.

I hope you can get away with something like:

openvpn_conf 'server' do
    config node['openvpn']['config']
end

Can you try that and let us know?

cbanciu667 commented 6 years ago

Adapted my cookbook. Is working with the conf source now.

Thanks!

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.