run mysql_install_db if datadir is set annd mysql database is missing

This commit is contained in:
Reinhard Vicinus 2013-12-26 22:39:55 +01:00 committed by Ashley Penney
parent 4375d76c09
commit 6f5488827a

View file

@ -6,4 +6,17 @@ class mysql::server::install {
name => $mysql::server::package_name,
}
# run mysql_install_db if datadir is set and datadir doesn't contain the
# mysql database (directory)
if $mysql::server::override_options['mysqld'] and $mysql::server::override_options['mysqld']['datadir'] {
$mysqluser = $mysql::server::options['mysqld']['user']
$datadir = $mysql::server::override_options['mysqld']['datadir']
exec { "mysql_install_db":
command => "mysql_install_db --datadir=$datadir --user=$mysqluser",
creates => "$datadir/mysql",
logoutput => on_failure,
}
}
}