- From: Vladimir Skubriev <
>
- To:
- Subject: [chef] how to check if a database is populated(in work state) for idempotent recipes - best practic question
- Date: Mon, 16 Sep 2013 16:06:36 +0400
I write redmine cookbook for our server.
I populate database for redmine (I'm doing it this way):
----------------------
script "populate_db" do
interpreter "bash"
user "root"
cwd "/tmp"
code <<-EOF
#!/bin/bash
var=$(mysql -s -u root
--password=#{node['mysql']['server_root_password']} -e "SELECT COUNT(*)
FROM information_schema.tables WHERE table_schema = 'redmine'" | sed '2p')
if [[ $var -lt 59 ]]; then
mysql -u root
--password=#{node['mysql']['server_root_password']} <
/etc/custom/redmine/mysql/latest/redmine.sql
if [[ $? -eq 0 ]]; then exit 0; else exit 6666; fi
else
exit 0;
fi
EOF
end
-------------------
I think that this way is not true. First of all I am newbee in Ruby (.
But I know some of bash scripting.
What do you think for:
1. Most safely method to populate database in my recipe. For example
bestest method to check if the database is in working state?
Of course I can add some code to save database before this code -
for secure my data.
2. Most perspective methods for doing this
3. What do you think about populate database in automated recipe. May be
this is not true and i must do it manual after all ?
Thank you.
--
Best regards,
CVisionLab System Administrator
Vladmir Skubriev
- [chef] how to check if a database is populated(in work state) for idempotent recipes - best practic question, Vladimir Skubriev, 09/16/2013
Archive powered by MHonArc 2.6.16.