389
|
1 # @summary
|
|
2 # Binary log configuration requires the mysql user to be present. This must be done after package install.
|
|
3 #
|
|
4 # @api private
|
|
5 #
|
|
6 class mysql::server::managed_dirs {
|
|
7 $options = $mysql::server::_options
|
|
8 $includedir = $mysql::server::includedir
|
|
9 $managed_dirs = $mysql::server::managed_dirs
|
|
10
|
|
11 #Debian: Fix permission on directories
|
|
12 if $managed_dirs {
|
|
13 $managed_dirs_path = $managed_dirs.map |$path| { $options['mysqld']["${path}"] }
|
|
14 $managed_dirs.each | $entry | {
|
|
15 $dir = $options['mysqld']["${entry}"]
|
|
16 if ( $dir and $dir != '/usr' and $dir != '/tmp' ) {
|
|
17 file { "${entry}-managed_dir":
|
|
18 ensure => directory,
|
|
19 path => $dir,
|
|
20 mode => '0700',
|
|
21 owner => $options['mysqld']['user'],
|
|
22 group => $options['mysqld']['user'],
|
|
23 }
|
|
24 }
|
|
25 }
|
|
26 } else {
|
|
27 $managed_dirs_path = []
|
|
28 }
|
|
29
|
|
30 $logbin = pick($options['mysqld']['log-bin'], $options['mysqld']['log_bin'], false)
|
|
31
|
|
32 if $logbin {
|
|
33 $logbindir = dirname($logbin)
|
|
34
|
|
35 #Stop puppet from managing directory if just a filename/prefix is specified or is not already managed
|
|
36 if (!($logbindir == '.' or $logbindir in $managed_dirs_path)) {
|
|
37 file { $logbindir:
|
|
38 ensure => directory,
|
|
39 mode => '0700',
|
|
40 owner => $options['mysqld']['user'],
|
|
41 group => $options['mysqld']['user'],
|
|
42 }
|
|
43 }
|
|
44 }
|
|
45 }
|