Community cookbooks fail after upgrade to chef11


#1

New to chef/ruby so this may be something rather silly that I’m missing

I am using vagrant with berkshelf to work with testing cookbooks. They all work with the default vagrant box http://files.vagrantup.com/precise32.box, which is running chef10

When I upgrade the chef version on the vagrant box with gem to 11.4.4, the cookbooks start to fail. I upgrade/do nothing else on the box but the gem update and then try vagrant reload.

Two of the books failing are community cookbooks – tmux and ack, which are fairly basic.


For tmux, I’m getting this error:
FATAL: NoMethodError: undefined method `[]’ for nil:NilClass

The ack one is very similar

When I replace the recipe/default.rb with hard values instead of variables, everything works, so its almost like the attributes aren’t being passed in? I am including the recipe from my “application cookbook” (maybe I need to set all the attributes in my application cookbook as include_recipe doesn’t pull these? But it worked in chef10?)

from my_app_cookbook/recipes/default.rb

none of these should require parameters/attributes, take the defaults

include_recipe "ack"
include_recipe “tmux”

Sorry this isn’t much to go on, but can someone confirm that tmux/ack are working for on chef11, or point me in a direction?


#2

I want to say I’ve run into this issue before, it’s something they changed in one of the 10.x.x releases. I can’t remember exactly, but I think it had something to do with the attributes hash not returning an empty hash, but nil. Post a more detailed backtrace possibly?

On Tuesday, May 28, 2013 at 4:41 PM, Kyle Sloan wrote:

New to chef/ruby so this may be something rather silly that I’m missing

I am using vagrant with berkshelf to work with testing cookbooks. They all work with the default vagrant box http://files.vagrantup.com/precise32.box, which is running chef10

When I upgrade the chef version on the vagrant box with gem to 11.4.4, the cookbooks start to fail. I upgrade/do nothing else on the box but the gem update and then try vagrant reload.

Two of the books failing are community cookbooks – tmux and ack, which are fairly basic.
https://github.com/opscode-cookbooks/tmux
https://github.com/cap10morgan/ack-cookbook

For tmux, I’m getting this error:
FATAL: NoMethodError: undefined method `[]’ for nil:NilClass

The ack one is very similar

When I replace the recipe/default.rb with hard values instead of variables, everything works, so its almost like the attributes aren’t being passed in? I am including the recipe from my “application cookbook” (maybe I need to set all the attributes in my application cookbook as include_recipe doesn’t pull these? But it worked in chef10?)

from my_app_cookbook/recipes/default.rb

none of these should require parameters/attributes, take the defaults

include_recipe "ack"
include_recipe “tmux”

Sorry this isn’t much to go on, but can someone confirm that tmux/ack are working for on chef11, or point me in a direction?


#3

Where are you seeing the issue? ISTR seeing something like this with a
change to the knife.rb config, but the cookbooks themselves worked fine.


~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS

On Tue, May 28, 2013 at 2:41 PM, Kyle Sloan ksloan@2dialog.com wrote:

New to chef/ruby so this may be something rather silly that I’m missing

I am using vagrant with berkshelf to work with testing cookbooks. They
all work with the default vagrant box
http://files.vagrantup.com/precise32.box, which is running chef10

When I upgrade the chef version on the vagrant box with gem to 11.4.4, the
cookbooks start to fail. I upgrade/do nothing else on the box but the gem
update and then try vagrant reload.

Two of the books failing are community cookbooks – tmux and ack, which
are fairly basic.
https://github.com/opscode-cookbooks/tmux
https://github.com/cap10morgan/ack-cookbook

For tmux, I’m getting this error:
FATAL: NoMethodError: undefined method `[]’ for nil:NilClass

The ack one is very similar

When I replace the recipe/default.rb with hard values instead of
variables, everything works, so its almost like the attributes aren’t being
passed in? I am including the recipe from my “application cookbook” (maybe
I need to set all the attributes in my application cookbook as
include_recipe doesn’t pull these? But it worked in chef10?)

from my_app_cookbook/recipes/default.rb

none of these should require parameters/attributes, take the defaults

include_recipe "ack"
include_recipe “tmux”

Sorry this isn’t much to go on, but can someone confirm that tmux/ack are
working for on chef11, or point me in a direction?


#4

I posted my vagrant reload trace.

On May 28, 2013, at 4:44 PM, Preston Marshall <preston.marshall@complymd.commailto:preston.marshall@complymd.com> wrote:

I want to say I’ve run into this issue before, it’s something they changed in one of the 10.x.x releases. I can’t remember exactly, but I think it had something to do with the attributes hash not returning an empty hash, but nil. Post a more detailed backtrace possibly?

On Tuesday, May 28, 2013 at 4:41 PM, Kyle Sloan wrote:

New to chef/ruby so this may be something rather silly that I’m missing

I am using vagrant with berkshelf to work with testing cookbooks. They all work with the default vagrant box http://files.vagrantup.com/precise32.box, which is running chef10

When I upgrade the chef version on the vagrant box with gem to 11.4.4, the cookbooks start to fail. I upgrade/do nothing else on the box but the gem update and then try vagrant reload.

Two of the books failing are community cookbooks – tmux and ack, which are fairly basic.


For tmux, I’m getting this error:
FATAL: NoMethodError: undefined method `[]’ for nil:NilClass

The ack one is very similar

When I replace the recipe/default.rb with hard values instead of variables, everything works, so its almost like the attributes aren’t being passed in? I am including the recipe from my “application cookbook” (maybe I need to set all the attributes in my application cookbook as include_recipe doesn’t pull these? But it worked in chef10?)

from my_app_cookbook/recipes/default.rb

none of these should require parameters/attributes, take the defaults

include_recipe "ack"
include_recipe “tmux”

Sorry this isn’t much to go on, but can someone confirm that tmux/ack are working for on chef11, or point me in a direction?


#5

On Tuesday, May 28, 2013 at 2:41 PM, Kyle Sloan wrote:

New to chef/ruby so this may be something rather silly that I’m missing

I am using vagrant with berkshelf to work with testing cookbooks. They all work with the default vagrant box http://files.vagrantup.com/precise32.box, which is running chef10

When I upgrade the chef version on the vagrant box with gem to 11.4.4, the cookbooks start to fail. I upgrade/do nothing else on the box but the gem update and then try vagrant reload.

Two of the books failing are community cookbooks – tmux and ack, which are fairly basic.
https://github.com/opscode-cookbooks/tmux
https://github.com/cap10morgan/ack-cookbook

For tmux, I’m getting this error:
FATAL: NoMethodError: undefined method `[]’ for nil:NilClass

The ack one is very similar

When I replace the recipe/default.rb with hard values instead of variables, everything works, so its almost like the attributes aren’t being passed in? I am including the recipe from my “application cookbook” (maybe I need to set all the attributes in my application cookbook as include_recipe doesn’t pull these? But it worked in chef10?)

from my_app_cookbook/recipes/default.rb

none of these should require parameters/attributes, take the defaults

include_recipe "ack"
include_recipe “tmux”

Sorry this isn’t much to go on, but can someone confirm that tmux/ack are working for on chef11, or point me in a direction?
The issue is that you’re including these recipes from a 3rd cookbook that does not specify a dependency in the metadata. In Chef 11.x, chef-client and solo use the dependency data to figure out the correct order to load attribute (and other) files. If a dependency is missing, the attribute files won’t get loaded at all and usually you barf on missing attributes.

If you add depends statements to my_app_cookbook/metadata.rb, everything will work normally.


Daniel DeLeo


#6

Thanks, that has solved the problem.

On May 28, 2013, at 5:04 PM, Daniel DeLeo <dan@kallistec.commailto:dan@kallistec.com> wrote:

On Tuesday, May 28, 2013 at 2:41 PM, Kyle Sloan wrote:

New to chef/ruby so this may be something rather silly that I’m missing

I am using vagrant with berkshelf to work with testing cookbooks. They all work with the default vagrant box http://files.vagrantup.com/precise32.box, which is running chef10

When I upgrade the chef version on the vagrant box with gem to 11.4.4, the cookbooks start to fail. I upgrade/do nothing else on the box but the gem update and then try vagrant reload.

Two of the books failing are community cookbooks – tmux and ack, which are fairly basic.


For tmux, I’m getting this error:
FATAL: NoMethodError: undefined method `[]’ for nil:NilClass

The ack one is very similar

When I replace the recipe/default.rb with hard values instead of variables, everything works, so its almost like the attributes aren’t being passed in? I am including the recipe from my “application cookbook” (maybe I need to set all the attributes in my application cookbook as include_recipe doesn’t pull these? But it worked in chef10?)

from my_app_cookbook/recipes/default.rb

none of these should require parameters/attributes, take the defaults

include_recipe "ack"
include_recipe “tmux”

Sorry this isn’t much to go on, but can someone confirm that tmux/ack are working for on chef11, or point me in a direction?
The issue is that you’re including these recipes from a 3rd cookbook that does not specify a dependency in the metadata. In Chef 11.x, chef-client and solo use the dependency data to figure out the correct order to load attribute (and other) files. If a dependency is missing, the attribute files won’t get loaded at all and usually you barf on missing attributes.

If you add depends statements to my_app_cookbook/metadata.rb, everything will work normally.


Daniel DeLeo