244
|
1 # @summary
|
|
2 # Builds initial databases on installation.
|
|
3 #
|
|
4 # @api private
|
|
5 #
|
|
6 class mysql::server::installdb {
|
|
7 $options = $mysql::server::options
|
|
8
|
|
9 if $mysql::server::package_manage {
|
|
10
|
|
11 # Build the initial databases.
|
|
12 $mysqluser = $mysql::server::options['mysqld']['user']
|
|
13 $datadir = $mysql::server::options['mysqld']['datadir']
|
|
14 $basedir = $mysql::server::options['mysqld']['basedir']
|
|
15 $config_file = $mysql::server::config_file
|
|
16 $log_error = $mysql::server::options['mysqld']['log-error']
|
|
17
|
|
18 if $mysql::server::manage_config_file and $config_file != $mysql::params::config_file {
|
|
19 $_config_file=$config_file
|
|
20 } else {
|
|
21 $_config_file=undef
|
|
22 }
|
|
23
|
|
24 if $options['mysqld']['log-error'] {
|
|
25 file { $options['mysqld']['log-error']:
|
|
26 ensure => present,
|
|
27 owner => $mysqluser,
|
|
28 group => $::mysql::server::mysql_group,
|
|
29 mode => 'u+rw',
|
|
30 before => Mysql_datadir[ $datadir ],
|
|
31 }
|
|
32 }
|
|
33
|
|
34 mysql_datadir { $datadir:
|
|
35 ensure => 'present',
|
|
36 datadir => $datadir,
|
|
37 basedir => $basedir,
|
|
38 user => $mysqluser,
|
|
39 log_error => $log_error,
|
|
40 defaults_extra_file => $_config_file,
|
|
41 }
|
|
42
|
|
43 if $mysql::server::restart {
|
|
44 Mysql_datadir[$datadir] {
|
|
45 notify => Class['mysql::server::service'],
|
|
46 }
|
|
47 }
|
|
48 }
|
|
49
|
|
50 }
|