From 7d3962fc280b1765c13b2f45ed4a99e9f271961d Mon Sep 17 00:00:00 2001 From: takumi Date: Fri, 5 Dec 2014 18:45:38 +0900 Subject: [PATCH] mysql_install_db freebsd support --- manifests/server/install.pp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/manifests/server/install.pp b/manifests/server/install.pp index daea460b7..5fb89dbb0 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -8,22 +8,28 @@ } # Build the initial databases. - 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'] + $mysqluser = $mysql::server::options['mysqld']['user'] + $datadir = $mysql::server::options['mysqld']['datadir'] + $basedir = $mysql::server::options['mysqld']['basedir'] + $config_file = $mysql::server::config_file - exec { 'mysql_install_db': - command => "mysql_install_db --datadir=${datadir} --user=${mysqluser}", - creates => "${datadir}/mysql", - logoutput => on_failure, - path => '/bin:/sbin:/usr/bin:/usr/sbin', - require => Package['mysql-server'], - } + if $mysql::server::manage_config_file { + $install_db_args = "--basedir=${basedir} --defaults-extra-file=${config_file} --datadir=${datadir} --user=${mysqluser}" + } else { + $install_db_args = "--basedir=${basedir} --datadir=${datadir} --user=${mysqluser}" + } + + exec { 'mysql_install_db': + command => "mysql_install_db ${install_db_args}", + creates => "${datadir}/mysql", + logoutput => on_failure, + path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin', + require => Package['mysql-server'], + } - if $mysql::server::restart { - Exec['mysql_install_db'] { - notify => Class['mysql::server::service'], - } + if $mysql::server::restart { + Exec['mysql_install_db'] { + notify => Class['mysql::server::service'], } }