efroese/puppet-mysql — pull request #1 by kcampos (2012-09-25 00:03:32+00:00)
Title: Add ability to specify data_dir and backupdir from caller

This adds the data_dir and backup_dir options to mysql::server so they can be specified from the caller. This passed my tests, the only error you will see if exercised is this:

err: /Stage[main]/Mysql::Server/File[/dbdata]: Failed to generate additional resources using 'eval_generate: Cannot manage files of type socket

And that comes from the code block at mysql::server line 48:

if( "${mysql::params::data_dir}" != "/var/lib/mysql" ) {
File["${mysql::params::data_dir}"]{
source => "/var/lib/mysql",
recurse => true,
replace => false,
}
}

Copying all that data succeeds but it won't copy the mysql.sock file, which is fine. You could split this out into an exec and handle the file copying separately to avoid this, but I wanted to touch as little code as possible to get this working.