- From: Raphael Bauduin <
>
- To:
- Subject: [chef] Re: Re: mysql recipe on ubuntu
- Date: Mon, 22 Aug 2011 11:27:03 +0200
Hi Madhurranjan,
On Thu, Aug 18, 2011 at 8:20 PM, Madhurranjan Mohaan
<
>
wrote:
>
Hi Raphael,
>
Not sure if this would help your case but this is more for a centos
>
installation .We had trouble to make sure that we assign the password only
>
the first time and do certain checks. Basically we wanted it to be
>
idempotent. We used something to this effect:. It wouldn't enter this block
>
if mysql server was already installed and we added definitions to
>
create/delete DBs and modify passwords.
thanks, but this does not apply to my problem. I need the recipe to
wait until the mysql server is ready.
Raph
>
if ! File.exists?("/var/lib/mysql/mysql/user.MYD")
>
package "mysql-server" do
>
action :install
>
end
>
service "mysqld" do
>
action [:start,:enable]
>
end
>
execute "creating 'mysqladmin' required files at '/var/lib/mysql'" do
>
command "/etc/init.d/mysqld restart >> /tmp/mysql.log"
>
end
>
execute "set_password" do
>
command "<set password>"
>
end
>
end
>
thanks
>
Madhurranjan
>
On Thu, Aug 18, 2011 at 1:52 PM, Raphael Bauduin
>
<
>
>
wrote:
>
>
>
> 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
>
>
--
Web database:
http://www.myowndb.com
Free Software Developers Meeting:
http://www.fosdem.org
Archive powered by MHonArc 2.6.16.