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

Cookbook blows up when centos platform does not exist #2

Open
mearns opened this issue Feb 29, 2016 · 1 comment
Open

Cookbook blows up when centos platform does not exist #2

mearns opened this issue Feb 29, 2016 · 1 comment

Comments

@mearns
Copy link

mearns commented Feb 29, 2016

I'm not entirely clear on what's causing this problem, but when I try to converge my node, I get the following error from the unix_bin cookbook:

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/unix_bin/definitions/providers.rb
================================================================================

NoMethodError
-------------
undefined method `[]' for nil:NilClass

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/unix_bin/definitions/providers.rb:7:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/unix_bin/definitions/providers.rb:

  1:  #
  2:  # This definition is used to assign the providers to their resources.
  3:  #
  4:  # Definition files are loaded after providers and resources, but
  5:  # before recipies. (and are not run-list sensitive like receipes)
  6:  #
  7>> Chef::Platform.platforms[:centos][:default][:unix_bin_package] = Chef::Provider::UnixBinPackageYum
  8:  Chef::Platform.platforms[:ubuntu][:default][:unix_bin_package] = Chef::Provider::UnixBinPackageApt  9:


Running handlers:
[2016-02-29T13:31:29-05:00] ERROR: Running exception handlers
Running handlers complete
[2016-02-29T13:31:29-05:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 03 seconds
[2016-02-29T13:31:29-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-02-29T13:31:29-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-02-29T13:31:29-05:00] ERROR: undefined method `[]' for nil:NilClass
[2016-02-29T13:31:29-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

And the chef-stacktrace.out file has the following:

Generated at 2016-02-29 13:31:29 -0500
NoMethodError: undefined method `[]' for nil:NilClass
/var/chef/cache/cookbooks/unix_bin/definitions/providers.rb:7:in `from_file'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/mixin/from_file.rb:30:in `from_file'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:232:in `block in load_resource_definitions_from_cookbook'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:228:in `each'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:228:in `load_resource_definitions_from_cookbook'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:130:in `block in compile_resource_definitions'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:129:in `each'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:129:in `compile_resource_definitions'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context/cookbook_compiler.rb:74:in `compile'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/run_context.rb:167:in `load'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/policy_builder/expand_node_object.rb:93:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:509:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/client.rb:277:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:270:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:258:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:223:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:211:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application/client.rb:405:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/lib/chef/application.rb:58:in `run'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.7.2/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:50:in `load'
/usr/bin/chef-client:50:in `<main>'

This is being run on Ubuntu, so I wonder if maybe the :centos key doesn't exist in the platforms hash? Just a guess, I know nothing about chef internals.

I'm not actually using this cookbook directly, I'm using the "service_factory" cookbook, which in turns depends on "unix_bin". From the looks of the stack trace, though, it's not about the specific use of the cookbook, though, it appears to be happening during some kind of initial compilation phase.

uname -a gives:

Linux myhostname 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

@jrnt30
Copy link

jrnt30 commented Jul 26, 2016

I believe the issue you are experiencing is that the last few versions of the application have not been uploaded to the Chef Supermarket and the CHANGELOG.md does not reference these changes either.

Currently the "released" version is "0.2.7" which was released in 2013. There have been a few subsequent changes for use in Chef 12 in the 0.2.8 and 0.2.9 releases which have not been uploaded to the Supermarket. Thus, without any customization, Chef/Berks will use the 0.2.7 version where this issue is.

We customized our Berksfile to point to the Git repo for now until this is resolved and released to the Chef Supermarket.

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

2 participants