Don't try and delete the same user from mysql twice

For security reasons we remove the anonymous user from mysql
"@localhost", we also remove "@hostname", this commit checks that the
hostname is not localhost so that we don't try and remove the same user
twice
https://bugzilla.redhat.com/show_bug.cgi?id=905737

Change-Id: If5e99b27503220b3308b487bb2912a39b24a3d05
This commit is contained in:
Derek Higgins
2013-01-30 19:19:42 -05:00
parent 5fa804cb78
commit 4e6418358a

View File

@@ -10,12 +10,12 @@ class {"mysql::server":
database_user { [ 'root@127.0.0.1', 'root@::1', '@localhost', '@%%' ]:
ensure => 'absent', require => Class['mysql::config'],
}
if ($::fqdn != "") {
if ($::fqdn != "" and $::fqdn != "localhost") {
database_user { [ "root@${::fqdn}", "@${::fqdn}"]:
ensure => 'absent', require => Class['mysql::config'],
}
}
if ($::fqdn != $::hostname) {
if ($::fqdn != $::hostname and $::hostname != "localhost") {
database_user { ["root@${::hostname}", "@${::hostname}"]:
ensure => 'absent', require => Class['mysql::config'],
}