Newbie question: errors in cookbooks

Hi,

I’m just starting with Chef, and am using the cookbooks from github,
but encounter some problems.
I have checked out all cookbooks and created my own recipe that is
run, and it is this recipe that requires the recipes I need from the
repository.
The first problem I get is in the tomcat6 recipe:
undefined method [] for nil:NilClass: stderr
it comes from the cookbook’s attribute file line 45:
https://github.com/opscode/cookbooks/blob/master/tomcat6/attributes/default.rb#L45

I think it occurs because it needs a specific config set to run, and I
didn’t set it. Does that mean it is a bad idea to checkout all recipes
and only require those I need in my own recipe?

Second, the mysql::server recipe causes errors.
The first time it runs, I get an error uninitialised constant Mysql.
When I run it again, I get an undefined method 'updated_by_last_action’
when I run it a third time, it passes.

Does anyone have the same behaviour? Any hint of the cause of this
strange behaviour?

I’m also wondering if it’s a good idea to use the cookbooks directly
from the git repo. Are these considered as stable enough to be used or
is it the development version? (I saw only a beta branch in addition
to the master branch, and no tag defined).

thanks in advance for your help!

Raphaël


Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

Raphael,

In general, cookbooks should declare their dependencies so including a given
recipe in your run list (say, recipe[tomcat6]) will pull in all the
dependent cookbooks. Oftentimes this results in "cookbook bloat" on a given
node, because the node will download a bunch of cookbooks that might not be
used - optional dependencies, essentially. You're in the opposite situation

  • tomcat6 needs Java to run, but it isn't a declared dependency.

Regarding the updated_by_last_action issue you're seeing - this is a
consequence of having your mysql cookbook out-of-sync with the requisite
chef-client version. What version of chef are you running, and what version
of the mysql cookbook are you running? If my memory is correct, the most
recent version of the mysql cookbook will break in the fashion you describe
if you're running Chef <= 0.9.8.

The cookbooks opscode maintains at GitHub - chef-boneyard/cookbooks: DEPRECATED: This repository has been split up into separate repositories by cookbook under the "opscode-cookbooks" organization. are
considered "in-development" and only pushed to the
cookbooks.opscode.comsite when they're stable. I used to use the
cookbooks from the git repo, but
switched to using the cookbooks.opscode.com site recently. The ability to
run "knife cookbook site vendor" to pull down the latest version and merge
it with local changes won me over. That said, there have been times when
I've wanted something a bit more bleeding edge and I've manually applied a
patch from the git repo.

-Paul

On Wed, Nov 10, 2010 at 5:15 AM, Raphael Bauduin rblists@gmail.com wrote:

Hi,

I'm just starting with Chef, and am using the cookbooks from github,
but encounter some problems.
I have checked out all cookbooks and created my own recipe that is
run, and it is this recipe that requires the recipes I need from the
repository.
The first problem I get is in the tomcat6 recipe:
undefined method for nil:NilClass: stderr
it comes from the cookbook's attribute file line 45:

https://github.com/opscode/cookbooks/blob/master/tomcat6/attributes/default.rb#L45

I think it occurs because it needs a specific config set to run, and I
didn't set it. Does that mean it is a bad idea to checkout all recipes
and only require those I need in my own recipe?

Second, the mysql::server recipe causes errors.
The first time it runs, I get an error uninitialised constant Mysql.
When I run it again, I get an undefined method 'updated_by_last_action'
when I run it a third time, it passes.

Does anyone have the same behaviour? Any hint of the cause of this
strange behaviour?

I'm also wondering if it's a good idea to use the cookbooks directly
from the git repo. Are these considered as stable enough to be used or
is it the development version? (I saw only a beta branch in addition
to the master branch, and no tag defined).

thanks in advance for your help!

Raphaël

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

On Wed, Nov 10, 2010 at 7:56 PM, Paul Paradise paulpar@gmail.com wrote:

Raphael,
In general, cookbooks should declare their dependencies so including a given
recipe in your run list (say, recipe[tomcat6]) will pull in all the
dependent cookbooks. Oftentimes this results in "cookbook bloat" on a given
node, because the node will download a bunch of cookbooks that might not be
used - optional dependencies, essentially. You're in the opposite situation

  • tomcat6 needs Java to run, but it isn't a declared dependency.
    Regarding the updated_by_last_action issue you're seeing - this is a
    consequence of having your mysql cookbook out-of-sync with the requisite
    chef-client version. What version of chef are you running, and what version
    of the mysql cookbook are you running? If my memory is correct, the most
    recent version of the mysql cookbook will break in the fashion you describe
    if you're running Chef <= 0.9.8.

That was indeed the cause. Thanks!

Raph

The cookbooks opscode maintains at GitHub - chef-boneyard/cookbooks: DEPRECATED: This repository has been split up into separate repositories by cookbook under the "opscode-cookbooks" organization. are
considered "in-development" and only pushed to the cookbooks.opscode.com
site when they're stable. I used to use the cookbooks from the git repo, but
switched to using the cookbooks.opscode.com site recently. The ability to
run "knife cookbook site vendor" to pull down the latest version and merge
it with local changes won me over. That said, there have been times when
I've wanted something a bit more bleeding edge and I've manually applied a
patch from the git repo.
-Paul

On Wed, Nov 10, 2010 at 5:15 AM, Raphael Bauduin rblists@gmail.com wrote:

Hi,

I'm just starting with Chef, and am using the cookbooks from github,
but encounter some problems.
I have checked out all cookbooks and created my own recipe that is
run, and it is this recipe that requires the recipes I need from the
repository.
The first problem I get is in the tomcat6 recipe:
undefined method for nil:NilClass: stderr
it comes from the cookbook's attribute file line 45:

https://github.com/opscode/cookbooks/blob/master/tomcat6/attributes/default.rb#L45

I think it occurs because it needs a specific config set to run, and I
didn't set it. Does that mean it is a bad idea to checkout all recipes
and only require those I need in my own recipe?

Second, the mysql::server recipe causes errors.
The first time it runs, I get an error uninitialised constant Mysql.
When I run it again, I get an undefined method 'updated_by_last_action'
when I run it a third time, it passes.

Does anyone have the same behaviour? Any hint of the cause of this
strange behaviour?

I'm also wondering if it's a good idea to use the cookbooks directly
from the git repo. Are these considered as stable enough to be used or
is it the development version? (I saw only a beta branch in addition
to the master branch, and no tag defined).

thanks in advance for your help!

Raphaël

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org