example42 / puppet-mysql

Mysql Puppet Module
http://www.example42.com
Other
16 stars 38 forks source link

MySQL not creating the grants #28

Closed lucadegasperi closed 11 years ago

lucadegasperi commented 11 years ago

Hello, It's me again. I'm using this mysql module with puppet-librarian and vagrant on ubuntu 12.10 (quantal). i'm creating a puppet manifest with this grant.

mysql::grant { 'development':
  mysql_privileges  => 'ALL',
  mysql_password    => 'development',
  mysql_db          => 'development',
  mysql_user        => 'development',
  mysql_host        => 'localhost',
}

when provisioning the vm i get this error and no database or user is created. this are the errors i get:

Notice: /Stage[main]//Mysql::Grant[development]/Exec[mysqlgrant-development-localhost-development]/returns: Could not open required defaults file: /root/.my.cnf
Notice: /Stage[main]//Mysql::Grant[development]/Exec[mysqlgrant-development-localhost-development]/returns: Fatal error in defaults handling. Program aborted
Error: /Stage[main]//Mysql::Grant[development]/Exec[mysqlgrant-development-localhost-development]: Failed to call refresh: mysql --defaults-file=/root/.my.cnf -uroot < /root/puppet-mysql/mysqlgrant-development-localhost-development.sql returned 1 instead of one of [0]
Error: /Stage[main]//Mysql::Grant[development]/Exec[mysqlgrant-development-localhost-development]: mysql --defaults-file=/root/.my.cnf -uroot < /root/puppet-mysql/mysqlgrant-development-localhost-development.sql returned 1 instead of one of [0]
alvagante commented 11 years ago

Add the mysql class and set a password for mysql : class { 'mysql': root_password => 'fsfdsf', }

In any case this is a bug, since it doesn't consider cases when the password is not set

lucadegasperi commented 11 years ago

The password was already set with the code you wrote above, yet I got this error.

alvagante commented 11 years ago

The above commits should solve.

lucadegasperi commented 11 years ago

No more red errors or warnings. The grants are not created (tried it with a fresh install of the virtual machine), maybe it's my fault.

alvagante commented 11 years ago

Uhm, on my tests (on Ubuntu12.04) database and grants have been created. This is the code I tested :

include example42::minimal # This setups and refreshes apt class { 'mysql': root_password => 'fsfdsf', } mysql::grant { 'development': mysql_privileges => 'ALL', mysql_password => 'development', mysql_db => 'development', mysql_user => 'development', mysql_host => 'localhost', }

lucadegasperi commented 11 years ago

including your minimal module made it work, we can consider this issue closed :) thanks for your support!

alvagante commented 11 years ago

Ok, note that example42::minimal just ensures that packages can be retrieved and lsb is installed. I use it, mostly on vagrant, to setup the minimal prerequistes for a puppet run.