Intermittent problem when provisioning with vagrant

Hi Chefs,

I’m building a cookbook for an application. It’s basically a set of gearman workers who convert videos, images and PDFs. I’m using Vagrant and Berkself for developing and testing the cookbook.

This provisioning in Vagrant fails intermittently though, making the whole experience a bit painful at times.

I created a gist with the relevant information (command output, log and attributes file where the error seems to be happening): https://gist.github.com/3932926

Please note that it doesn’t happen all the time, and usually when it does, if I keep issuing “bundle exec vagrant provision” it will eventually work (without me changing anything in the cookbook).

I’m kinda clueless, being new to Chef myself I don’t know where to look for the error.

Thanks!


Cassiano Leal

It looks like the attribute node[:zynk] is nil at the time the default
attribute file is loaded. Where is the value for 'node[:zynk][:appdir]'being
set?

Also, you should not use nested attributes (like what you have on line 1)
in your attributes file as Chef cannot guarantee the ordering of when
attributes are set from (attribute files, roles, environments..). I am
guessing this is your issue.

There was a recent discussion about this,
http://lists.opscode.com/sympa/arc/chef/2012-10/msg00266.html

On Mon, Oct 22, 2012 at 12:52 PM, Cassiano Leal cassianoleal@gmail.comwrote:

Hi Chefs,

I'm building a cookbook for an application. It's basically a set of
gearman workers who convert videos, images and PDFs. I'm using Vagrant and
Berkself for developing and testing the cookbook.

This provisioning in Vagrant fails intermittently though, making the whole
experience a bit painful at times.

I created a gist with the relevant information (command output, log and
attributes file where the error seems to be happening):
https://gist.github.com/3932926

Please note that it doesn't happen all the time, and usually when it does,
if I keep issuing "bundle exec vagrant provision" it will eventually work
(without me changing anything in the cookbook).

I'm kinda clueless, being new to Chef myself I don't know where to look
for the error.

Thanks!

--
Cassiano Leal

-Bryan

That attribute is originally set on the zynkbase cookbook, which is loaded as a dependency.

If I understand the discussion you linked correctly, one possible solution would be to set the node[:gearman][:dir] attribute in the zynkconverter default recipe, is that correct?

Thanks for your help!

--
Cassiano Leal

On Monday, October 22, 2012 at 15:58, Bryan Baugher wrote:

It looks like the attribute node[:zynk] is nil at the time the default attribute file is loaded. Where is the value for 'node[:zynk][:appdir]'being set?

Also, you should not use nested attributes (like what you have on line 1) in your attributes file as Chef cannot guarantee the ordering of when attributes are set from (attribute files, roles, environments..). I am guessing this is your issue.

There was a recent discussion about this, chef - [chef] Re: Re: Nested node attributes not working as expected when using overrides?

On Mon, Oct 22, 2012 at 12:52 PM, Cassiano Leal <cassianoleal@gmail.com (mailto:cassianoleal@gmail.com)> wrote:

Hi Chefs,

I'm building a cookbook for an application. It's basically a set of gearman workers who convert videos, images and PDFs. I'm using Vagrant and Berkself for developing and testing the cookbook.

This provisioning in Vagrant fails intermittently though, making the whole experience a bit painful at times.

I created a gist with the relevant information (command output, log and attributes file where the error seems to be happening): https://gist.github.com/3932926

Please note that it doesn't happen all the time, and usually when it does, if I keep issuing "bundle exec vagrant provision" it will eventually work (without me changing anything in the cookbook).

I'm kinda clueless, being new to Chef myself I don't know where to look for the error.

Thanks!

--
Cassiano Leal

-Bryan

Yes I believe that should fix your problem

On Mon, Oct 22, 2012 at 1:08 PM, Cassiano Leal cassianoleal@gmail.comwrote:

That attribute is originally set on the zynkbase cookbook, which is
loaded as a dependency.

If I understand the discussion you linked correctly, one possible solution
would be to set the node[:gearman][:dir] attribute in the zynkconverter
default recipe, is that correct?

Thanks for your help!

--
Cassiano Leal

On Monday, October 22, 2012 at 15:58, Bryan Baugher wrote:

It looks like the attribute node[:zynk] is nil at the time the default
attribute file is loaded. Where is the value for 'node[:zynk][:appdir]'being
set?

Also, you should not use nested attributes (like what you have on line 1)
in your attributes file as Chef cannot guarantee the ordering of when
attributes are set from (attribute files, roles, environments..). I am
guessing this is your issue.

There was a recent discussion about this,
chef - [chef] Re: Re: Nested node attributes not working as expected when using overrides?

On Mon, Oct 22, 2012 at 12:52 PM, Cassiano Leal cassianoleal@gmail.comwrote:

Hi Chefs,

I'm building a cookbook for an application. It's basically a set of
gearman workers who convert videos, images and PDFs. I'm using Vagrant and
Berkself for developing and testing the cookbook.

This provisioning in Vagrant fails intermittently though, making the whole
experience a bit painful at times.

I created a gist with the relevant information (command output, log and
attributes file where the error seems to be happening):
https://gist.github.com/3932926

Please note that it doesn't happen all the time, and usually when it does,
if I keep issuing "bundle exec vagrant provision" it will eventually work
(without me changing anything in the cookbook).

I'm kinda clueless, being new to Chef myself I don't know where to look
for the error.

Thanks!

--
Cassiano Leal

-Bryan

--
-Bryan

On Monday, October 22, 2012 at 11:08 AM, Cassiano Leal wrote:

That attribute is originally set on the zynkbase cookbook, which is loaded as a dependency.

If I understand the discussion you linked correctly, one possible solution would be to set the node[:gearman][:dir] attribute in the zynkconverter default recipe, is that correct?

Thanks for your help!

--
Cassiano Leal

On Monday, October 22, 2012 at 15:58, Bryan Baugher wrote:

It looks like the attribute node[:zynk] is nil at the time the default attribute file is loaded. Where is the value for 'node[:zynk][:appdir]'being set?

Also, you should not use nested attributes (like what you have on line 1) in your attributes file as Chef cannot guarantee the ordering of when attributes are set from (attribute files, roles, environments..). I am guessing this is your issue.

There was a recent discussion about this, http://lists.opscode.com/sympa/arc/chef/2012-10/msg00266.html

This is a slightly different issue. What's happening here is you're getting bit by nondeterministic load order of attribute files. There's been a lot of discussion on this bug/topic recently as well, but anyway, the way to fix it is to use include_attribute "zynkbase" in zynkconverter/attributes/default.rb, which will ensure that attributes file loads first.

--
Daniel DeLeo

If you upgrade the version of Chef inside your VM to 10.14 you will see the absolutely amazing error reporting that Dan and friends put into the latest version of Chef.

This will help you identify cookbook problems a lot easier and faster!

Jamie Winsor
@resetexistence

On Oct 22, 2012, at 11:15 AM, Daniel DeLeo dan@kallistec.com wrote:

On Monday, October 22, 2012 at 11:08 AM, Cassiano Leal wrote:

That attribute is originally set on the zynkbase cookbook, which is loaded as a dependency.

If I understand the discussion you linked correctly, one possible solution would be to set the node[:gearman][:dir] attribute in the zynkconverter default recipe, is that correct?

Thanks for your help!

--
Cassiano Leal

On Monday, October 22, 2012 at 15:58, Bryan Baugher wrote:

It looks like the attribute node[:zynk] is nil at the time the default attribute file is loaded. Where is the value for 'node[:zynk][:appdir]'being set?

Also, you should not use nested attributes (like what you have on line 1) in your attributes file as Chef cannot guarantee the ordering of when attributes are set from (attribute files, roles, environments..). I am guessing this is your issue.

There was a recent discussion about this, chef - [chef] Re: Re: Nested node attributes not working as expected when using overrides?

This is a slightly different issue. What's happening here is you're getting bit by nondeterministic load order of attribute files. There's been a lot of discussion on this bug/topic recently as well, but anyway, the way to fix it is to use include_attribute "zynkbase" in zynkconverter/attributes/default.rb, which will ensure that attributes file loads first.

--
Daniel DeLeo

I kind of missed the difference here. :slight_smile:

Either way, I tried both approaches. Both seem to work fine (I say "seem" because it's intermittent, so it could be that I'm just being lucky…). I like the include_attribute approach better, though, since it allows me to keep the recipe attribute-free.

Thanks for all the input, I'll come back here if it bites me again!

--
Cassiano Leal

On Monday, October 22, 2012 at 16:15, Daniel DeLeo wrote:

On Monday, October 22, 2012 at 11:08 AM, Cassiano Leal wrote:

That attribute is originally set on the zynkbase cookbook, which is loaded as a dependency.

If I understand the discussion you linked correctly, one possible solution would be to set the node[:gearman][:dir] attribute in the zynkconverter default recipe, is that correct?

Thanks for your help!

--
Cassiano Leal

On Monday, October 22, 2012 at 15:58, Bryan Baugher wrote:

It looks like the attribute node[:zynk] is nil at the time the default attribute file is loaded. Where is the value for 'node[:zynk][:appdir]'being set?

Also, you should not use nested attributes (like what you have on line 1) in your attributes file as Chef cannot guarantee the ordering of when attributes are set from (attribute files, roles, environments..). I am guessing this is your issue.

There was a recent discussion about this, chef - [chef] Re: Re: Nested node attributes not working as expected when using overrides?

This is a slightly different issue. What's happening here is you're getting bit by nondeterministic load order of attribute files. There's been a lot of discussion on this bug/topic recently as well, but anyway, the way to fix it is to use include_attribute "zynkbase" in zynkconverter/attributes/default.rb, which will ensure that attributes file loads first.

--
Daniel DeLeo