Problems using the MySQL recipe


#1

Hi all,

Using the MySQL recipe from Opscode with Vagrant 0.9.2 I get the
following error:


NameError: wrong constant name DebianBeforeSqueeze?
/opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/…/lib/chef/mixin/recipe_definition_dsl_core.rb:56:in
const_defined?' /opt/ruby/lib/ruby/gems/1.8/gems/chef-0.10.2/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:56:inmethod_missing’
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/mysql/recipes/client.rb:26:in
`from_file’

The problematic bit seems to be:

if debian_before_squeeze? || ubuntu_before_lucid?
%w{mysql-client libmysqlclient15-dev}
else
%w{mysql-client libmysqlclient-dev}
end

In an helper file the following definition is present:

 def debian_before_squeeze?
   platform?("debian") && (node.platform_version.to_f < 6.0)
 end

Given I’m using a Lucid 64 as an image, I simply changed the if block into:

%w{mysql-client libmysqlclient-dev}

Which made ‘vagrant up’ succeed. Still, it would be nice to understand
the reason of the error. Am I the only one facing this problem?

Cheers,

Roberto


#2

Hi

On Mon, Jan 23, 2012 at 12:15 AM, Roberto Aloi prof3ta@gmail.com wrote:

Which made ‘vagrant up’ succeed. Still, it would be nice to understand
the reason of the error. Am I the only one facing this problem?

You’re not alone. I’ve tracked down what I believe the source of the
bug is and reported it here:

http://tickets.opscode.com/browse/COOK-992

I think another way to work around it would be to add the following to
the recipe:

include Opscode::Mysql::Helpers

but I haven’t had a chance to test it out yet.

Cheers,

Steve


#3

On Tue, Jan 24, 2012 at 1:04 PM, Steven Danna steve@opscode.com wrote:

include Opscode::Mysql::Helpers

This will cause an error too since you can call include right from the
recipe. But the short version of the story is that you need to
include the Helpers in the Recipe class.

::Chef::Recipe.send(:include, Opscode::Mysql::Helpers)