chr4-cookbooks / iptables-ng

Cookbook to maintain iptables rules and policies on different platforms, respecting the way the os handles these settings.
GNU General Public License v3.0
38 stars 33 forks source link

Missing 'manage' recipe? #71

Closed infertux closed 5 years ago

infertux commented 5 years ago

I'm getting an error when I use the iptables_ng_rule resource without explicitely including the iptables-ng::manage recipe:

iptables_ng_rule '50-whatever' do
  rule "..."
  action :delete
end
iptables_ng_rule[50-whatever] action delete

================================================================================
Error executing action `delete` on resource 'iptables_ng_rule[50-whatever]'
================================================================================

Chef::Exceptions::ResourceNotFound
----------------------------------
resource file[/etc/iptables.d/filter/INPUT/50-whatever.rule_v4] is configured to notify resource ruby_block[create_rules] with action create,
but ruby_block[create_rules] cannot be found in the resource collection. file[/etc/iptables.d/filter/INPUT/50-whatever.rule_v4] is defined in
/tmp/kitchen/cache/cookbooks/iptables-ng/providers/rule.rb:44:in `block in edit_rule'
       System Info:
       ------------
       chef_version=14.5.33
       platform=debian
       platform_version=9.5
       ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client

Adding include_recipe 'iptables-ng::manage in my own cookbook does the trick but shouldn't it be loaded automatically by the iptables-ng cookbook ideally?

chr4 commented 5 years ago

You're right in assuming, that it shouldn't be required to include iptables::manage. I think this might be related to changes in Chef-13+ - Unfortunately, I didn't find any time so far in properly adapting the cookbook for newer Chef versions. :(

I'm looking forward for contribution or improvements and tests in this direction, if you have some time to spare!

Thanks for reporting this!

chr4 commented 5 years ago

Closing this in favor of https://github.com/chr4-cookbooks/iptables-ng/pull/72/