Dependency issue with cookbook that uses gem with native code

I’m trying to provision a server with a cookbook that uses the mysql_database resource from the database cookbook. This cookbook depends on the mysql cookbook, which requires building due to references to native code (e.g. libmysqlclient). In trying to bootstrap a brand new node, which doesn’t have gcc (and other build-essential components), I cannot get past the error:

Error executing action install on resource ‘chef_gem[mysql]’

My cookbook has a “depends” statement for the “database” cookbook. And that cookbook has a dependency on “mysql”. Prior to executing any of the recipes in any of the defined cookbook, chef-client tries to compile the cookbooks it knows it needs. It can’t build the “mysql” cookbook because gcc is not yet installed. While I’ve added “recipe[build-essential]” to the head of my run_list for the role, chef-client never gets this far, as it wants to compile all cookbooks in the dependency list prior to executing any of the recipes in the run list.

How do I get around this? I want to bootstrap a node that doesn’t have gcc installed (yet). How do I get chef-client to install the build-essential package BEFORE compiling cookbooks?

– Eric

@Eric, I guess after including the build-essential recipe, you have to set
the

node['build_essential']['compiletime'] = true

to tell chef to install at the compile phase.

@millisami
~Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com

On Mon, Nov 18, 2013 at 6:05 AM, Eric Swenson eswenson@intertrust.comwrote:

I'm trying to provision a server with a cookbook that uses the
mysql_database resource from the database cookbook. This cookbook depends
on the mysql cookbook, which requires building due to references to native
code (e.g. libmysqlclient). In trying to bootstrap a brand new node, which
doesn't have gcc (and other build-essential components), I cannot get past
the error:

Error executing action install on resource 'chef_gem[mysql]'

My cookbook has a "depends" statement for the "database" cookbook. And
that cookbook has a dependency on "mysql". Prior to executing any of the
recipes in any of the defined cookbook, chef-client tries to compile the
cookbooks it knows it needs. It can't build the "mysql" cookbook because
gcc is not yet installed. While I've added "recipe[build-essential]" to the
head of my run_list for the role, chef-client never gets this far, as it
wants to compile all cookbooks in the dependency list prior to executing
any of the recipes in the run list.

How do I get around this? I want to bootstrap a node that doesn't have
gcc installed (yet). How do I get chef-client to install the
build-essential package BEFORE compiling cookbooks?

-- Eric

On Sun, Nov 17, 2013 at 7:20 PM, Eric Swenson eswenson@intertrust.com wrote:

I'm trying to provision a server with a cookbook that uses the mysql_database resource from the database cookbook. This cookbook depends on the mysql cookbook, which requires building due to references to native code (e.g. libmysqlclient).
In trying to bootstrap a brand new node, which doesn't have gcc (and other build-essential components), I cannot get past the error:

Error executing action install on resource 'chef_gem[mysql]'

My cookbook has a "depends" statement for the "database" cookbook. And that cookbook has a dependency on "mysql". Prior to executing any of the recipes in any of the defined cookbook, chef-client tries to compile the cookbooks it knows it needs.
It can't build the "mysql" cookbook because gcc is not yet installed. While I've added "recipe[build-essential]" to the head of my run_list for the role, chef-client never gets this far, as it wants to compile all cookbooks in the dependency list prior to executing
any of the recipes in the run list.

How do I get around this? I want to bootstrap a node that doesn't have gcc installed (yet). How do I get chef-client to install the build-essential package BEFORE compiling cookbooks?

All that compile-time hackery code is an abomination. That aside, if
you include database::mysql in your run_list prior it will deal with
the setup of build-essential as a compile-time dependency.

  • Julian

--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: Julian Dunn's Blog - Commentary on media, technology, and everything in between. * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]