chef-cookbooks / iptables

Development repository for Chef Cookbook iptables
https://supermarket.chef.io/cookbooks/iptables
Apache License 2.0
102 stars 141 forks source link

No resource or method named `with_run_context' for `LWRP resource iptables_rule from cookbook iptables action provider #73

Closed orarnon closed 7 years ago

orarnon commented 7 years ago

Cookbook version

~> 4.0.0

Chef-client version

Chef: 12.5.1

Platform Details

Ubuntu 12

Scenario:

Running Chef and encounter:

  * iptables_rule[cassandra] action enable

    ================================================================================
    Error executing action `enable` on resource 'iptables_rule[cassandra]'
    ================================================================================

    NoMethodError
    -------------
    No resource or method named `with_run_context' for `LWRP resource iptables_rule from cookbook iptables action provider "cassandra"'

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/iptables/resources/rule.rb:28:in `block in class_from_file'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/sonic-phpapp/recipes/iptables.rb

      1: iptables_rule 'cassandra' do
      2:   action :enable
      3: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/sonic-phpapp/recipes/iptables.rb:1:in `from_file'

    iptables_rule("cassandra") do
      action [:enable]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :iptables_rule
      cookbook_name "sonic-phpapp"
      recipe_name "iptables"
    end
iennae commented 7 years ago

Thanks for reporting this issue. With the rewrite of the rule resource with this commit, https://github.com/chef-cookbooks/iptables/commit/136cfb223ed0c5bba3eaa36568b20fa526bb4dec in order to make sure that rebuild-iptables only runs once this cookbook requires Chef 12.10+. https://docs.chef.io/release_notes.html#with-run-context for more information.

iennae commented 7 years ago

The metadata and README has been updated to reflect the Chef 12.10 requirement. Thanks again for reporting.