module-puppetlabs-mysql/manifests/server/root_password.pp
David Gurtner b3c33f0a13 fix bug in GH-578
the recently added feature to support galera by allowing independent
creation of the root@localhost user in the DB and the /root/.my.cnf
file contains a bug.

specifically the .my.cnf file resource still requires the root@localhost
resource, even when it is not available.

this fixes the issue by making the dependency conditional.
2015-02-16 17:01:18 +01:00

25 lines
729 B
Puppet

#
class mysql::server::root_password {
$options = $mysql::server::options
# manage root password if it is set
if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' {
mysql_user { 'root@localhost':
ensure => present,
password_hash => mysql_password($mysql::server::root_password),
}
}
if $mysql::server::create_root_my_cnf == true and $mysql::server::root_password != 'UNSET' {
file { "${::root_home}/.my.cnf":
content => template('mysql/my.cnf.pass.erb'),
owner => 'root',
mode => '0600',
}
if $mysql::server::create_root_user == true {
Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"]
}
}
}