chef-cookbooks / iptables

Development repository for Chef Cookbook iptables

Home Page:https://supermarket.chef.io/cookbooks/iptables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong number of arguments for iptables_rule

isuftin opened this issue · comments

Recipe: caws-zabbix::iptables_httpd


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

           ArgumentError
           -------------
           wrong number of arguments (1 for 0)

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb:39:in `initialize'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/resource_builder.rb:39:in `initialize'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb:100:in `new'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb:100:in `build_resource'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/dsl/declare_resource.rb:67:in `declare_resource'
           /tmp/kitchen/cache/cookbooks/iptables/resources/rule.rb:26:in `block in class_from_file'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:118:in `instance_eval'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:118:in `compile_and_converge_action'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/caws-zabbix/recipes/iptables_httpd.rb

             6: iptables_rule 'http' do
             7:   action :enable
             8: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/caws-zabbix/recipes/iptables_httpd.rb:6:in `from_file'

           iptables_rule("http") do
             action [:enable]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :iptables_rule
             cookbook_name "caws-zabbix"
          recipe_name "iptables_httpd"
           end


       Running handlers:
       [2016-02-08T17:08:14+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-02-08T17:08:14+00:00] ERROR: Exception handlers complete
       Chef Client failed. 1 resources updated in 05 seconds
       [2016-02-08T17:08:14+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2016-02-08T17:08:14+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2016-02-08T17:08:14+00:00] ERROR: iptables_rule[http] (caws-zabbix::iptables_httpd line 6) had an error: ArgumentError: wrong number of arguments (1 for 0)
       [2016-02-08T17:08:16+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

This seemed to have been working last week but this morning it seems to not be.

Chef Client is version 12.6.0 on a CentOS 6.7 VM.

The recipe:

#
# Cookbook Name:: caws-zabbix
# Recipe:: iptables_httpd
# Description:: Opens IPTables for port 80 (Zabbix)

iptables_rule 'http' do
  action :enable
end

The http.erb file:
-A FWR -p tcp -m tcp --dport 80 -j ACCEPT

Looks like others are having similar issues here: https://github.com/chef-cookbooks/compat_resource/issues/37

If they'd ever merge my PR chef-boneyard/compat_resource#41, it would fix chef-cookbooks/compat_resource#37 and solve this problem.

I've confirmed this is still an issue for RHEL systems running chef-client 12.7 and the compat_resource 12.7 cookbook. I'm working to see what we can do to get that compat_resource fix out.

@isuftin can you verify whether you are still having this issue? As of Feb 19 a fix was put into compat_resource and released with version 12.7.3.

This went away for me with the newer versions of compat_resource

@b-dean Thanks so much for the confirmation. @isuftin I'm going to go ahead and close this as the newer version of compat_resource appears to fix the problem. Please reopen if you are still having an issue.

Thanks!