[chef] developing a mysql resource


Chronological Thread 
  • From: Dmitry V'yal < >
  • To:
  • Subject: [chef] developing a mysql resource
  • Date: Wed, 21 Jul 2010 16:56:00 +0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=bIXuaTPpOQ0WfhdKXlEqd/WJ9+m+eY+xTHKt44y+bLY9vhsM9EooWBFoOTFiS8cW4r 6eNloP2Ti5YNLgrybAIJ76IFgz/sXHzo1kmxV6S7cbwGNU1K5rOlaEt2W38vyIsiwd/s 3x2Kvb4YaxTo+g657gnxpj/2wD3ko+fg3UQWQ=

Greetings, chefs!

I've decided to refactor my cookbooks and to separate the logic of creating and initial filling mysql databases into the lightweight resource. I took MysqlDatabase as a basis.

The idea was to create a database if one doesn't exist,
then to create the database user if it's name & password are specified and to fill the database with supplied data, if it's empty.

Unfortunately, I've run into the troubles while writing the provider action. Conditional statements of the action body are evaluated before resources defined above are run. For example, I can't make a test whether the database is empty because It would be created later than my test and corresponding 'if' statement is evaluated.

I think it's a frequent problem. I'd like the hear some thoughts and advices on how to avoid it.

Regards,
Dmitry

Attachment: database.rb
Description: application/ruby




Archive powered by MHonArc 2.6.16.

§