Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime errors under Chef 13 client #83

Open
briancline opened this issue Apr 17, 2017 · 2 comments
Open

Runtime errors under Chef 13 client #83

briancline opened this issue Apr 17, 2017 · 2 comments

Comments

@briancline
Copy link

I'm seeing a runtime error when attempting to use this under any Chef 13 client. The below occurs under a simple Ubuntu 14.04 VM under Test Kitchen:

       Recipe: simple_iptables::default
         * apt_package[iptables] action install (up to date)
         * ruby_block[run-iptables-resources-early] action run

           ================================================================================
           Error executing action `run` on resource 'ruby_block[run-iptables-resources-early]'
           ================================================================================

           NameError
           ---------
           uninitialized constant Chef::Resource::SimpleIptablesRule

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/simple_iptables/recipes/default.rb:41:in `block (3 levels) in from_file'
           /tmp/kitchen/cache/cookbooks/simple_iptables/recipes/default.rb:40:in `block (2 levels) in from_file'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/simple_iptables/recipes/default.rb

            34: ruby_block "run-iptables-resources-early" do
            35:   block do
            36:     # Clear old normal-level attributes set by previous versions of the cookbook
            37:     node.rm_normal("simple_iptables", "ipv4")
            38:     node.rm_normal("simple_iptables", "ipv6")
            39:     # Then run all the simple_iptables_* resources
            40:     run_context.resource_collection.each do |resource|
            41:       if resource.kind_of?(Chef::Resource::SimpleIptablesRule)
            42:         Chef::Log.debug("about to run simple_iptables_rule[#{resource.chain}]")
            43:         resource.run_action(resource.action)
            44:       elsif resource.kind_of?(Chef::Resource::SimpleIptablesPolicy)
            45:         Chef::Log.debug("about to run simple_iptables_policy[#{resource.chain}]")
            46:         resource.run_action(resource.action)
            47:       end
            48:     end
            49:
            50:     Chef::Log.debug("After run-iptables-resources-early data is: #{node['simple_iptables']}")
            51:   end
            52: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/simple_iptables/recipes/default.rb:34:in `from_file'

           ruby_block("run-iptables-resources-early") do
             action [:run]
             default_guard_interpreter :default
             block_name "run-iptables-resources-early"
             declared_type :ruby_block
             cookbook_name "simple_iptables"
             recipe_name "default"
             block #<Proc:0x00000004a97460@/tmp/kitchen/cache/cookbooks/simple_iptables/recipes/default.rb:35>
           end

           System Info:
           ------------
           chef_version=13.0.118
           platform=ubuntu
           platform_version=14.04
           ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
           program_name=chef-client worker: ppid=27618;start=22:51:20;
           executable=/opt/chef/bin/chef-client


       Running handlers:
       [2017-04-17T22:51:23+00:00] ERROR: Running exception handlers
       [2017-04-17T22:51:23+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2017-04-17T22:51:23+00:00] ERROR: Exception handlers complete
       [2017-04-17T22:51:23+00:00] ERROR: Exception handlers complete
       Chef Client failed. 19 resources updated in 02 seconds
       [2017-04-17T22:51:23+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2017-04-17T22:51:23+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2017-04-17T22:51:23+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2017-04-17T22:51:23+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2017-04-17T22:51:23+00:00] ERROR: ruby_block[run-iptables-resources-early] (simple_iptables::default line 34) had an error: NameError: uninitialized constant Chef::Resource::SimpleIptablesRule
       [2017-04-17T22:51:23+00:00] ERROR: ruby_block[run-iptables-resources-early] (simple_iptables::default line 34) had an error: NameError: uninitialized constant Chef::Resource::SimpleIptablesRule
       [2017-04-17T22:51:23+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
       [2017-04-17T22:51:23+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
@rtkrruvinskiy
Copy link
Contributor

I have not had the chance to try with Chef Client 13, but it looks like Chef Client changes in that release are incompatible with our hack to control when the resources converge. I will try to investigate this, but any community help here will be more than welcome!

@jeunito
Copy link

jeunito commented May 3, 2017

@rtkrruvinskiy I made a PR here #84 but it's failing on the "mangle" rules. I haven't figured out why.

tayasu pushed a commit to tayasu/cookbook-simple-iptables that referenced this issue Nov 2, 2019
tayasu pushed a commit to tayasu/cookbook-simple-iptables that referenced this issue Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants