[chef] mysql recipe on ubuntu


Chronological Thread 
  • From: Raphael Bauduin < >
  • To:
  • Subject: [chef] mysql recipe on ubuntu
  • Date: Thu, 18 Aug 2011 10:22:22 +0200

Hi,

I'm using the mysql recipe (
https://github.com/opscode/cookbooks/tree/master/mysql ;) with vagrant
and ubuntu 10.04.
The problem I encounter is that this code

execute "mysql-install-privileges" do
  command "/usr/bin/mysql -u root
#{node['mysql']['server_root_password'].empty? ? '' : '-p'
}#{node['mysql']['server_root_password']} < #{grants_path}"
  action :nothing
  subscribes :run, resources("template[#{grants_path}]"), :immediately
end

is run when the mysql daemon is not yet ready. In my own recipe, I
have put this code to wait for mysqld:

execute "wait for mysql" do
  action :run
  command "i=0 && while ! ps ax | grep mysqld | grep -v grep ; do echo
\"waiting.... $i\" >> /tmp/debug ; sleep 1; i=$((i+1)); [ $i -eq 29 ]
&& break; done ;  sleep 5; exit 0"
end

but this approach won't work as mysql-install-privileges is run by a
"subscribes :run".

Is there a way to tell an execute block to wait for a certain
condition? Or am I doing something wrong here, as the recipe is
indicated as being tested with ubuntu 10.04?

Thanks

raphaƫl



Archive powered by MHonArc 2.6.16.

§