Skip to content

Commit

Permalink
mysql_install_db freebsd support
Browse files Browse the repository at this point in the history
  • Loading branch information
takumin committed Dec 5, 2014
1 parent 67bf7a3 commit 7d3962f
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions manifests/server/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
}
}

Expand Down

0 comments on commit 7d3962f

Please sign in to comment.