]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Fix the mysql_grant call to not fail with puppetlabs-mysql 2.3
authorMartin Gerhard Loschwitz <m.loschwitz@syseleven.de>
Mon, 29 Sep 2014 12:10:17 +0000 (14:10 +0200)
committerMartin Gerhard Loschwitz <m.loschwitz@syseleven.de>
Mon, 29 Sep 2014 12:16:21 +0000 (14:16 +0200)
Due to a recent change in puppetlabs-mysql, the "host_access" call in
manifests/db/mysql/host_access.pp of the current puppet-ceilometer
module doesn't work anymore. The problem is obvious -- this is the
actual code:

    mysql_grant { "${user}@${name}/${database}":
      privileges => 'all',
      provider => 'mysql',
      table => "${database}.*",
      user => "${user}@${name}",
      require => Mysql_user["${user}@${name}"]
    }

As you will notice, mysql_grant now performs this check (as in
https://github.com/puppetlabs/puppetlabs-mysql/commit/07b661dcea926981cf5cd1c703a1c982d6eb6ef1):

fail('name must match user and table parameters') if self[:name] != "#{self[:user]}/#{self[:table]}

The problem here is that "${database}" is not equal to "${database}.*",
which will make the mysql_grant call fail. The fix simply is to change
the function's name:

    mysql_grant { "${user}@${name}/${database}.*":
      privileges => 'all',
      provider => 'mysql',
      table => "${database}.*",
      user => "${user}@${name}",
      require => Mysql_user["${user}@${name}"]
    }

This commit conducts the proposed change.

Change-Id: Ic9457cb8ad96a0d39f7a29d3e593e788bbeb6d28
Closes-Bug: 1375233

manifests/db/mysql/host_access.pp

index 9869f99499c4c128e737de877e1f32e6b4f0befc..7fe7adb4abf5e53e1fe5aca1448251b3b073435a 100644 (file)
@@ -22,7 +22,7 @@ define ceilometer::db::mysql::host_access ($user, $password, $database, $mysql_m
       require       => Mysql_database[$database],
     }
 
-    mysql_grant { "${user}@${name}/${database}":
+    mysql_grant { "${user}@${name}/${database}.*":
       privileges => 'all',
       provider   => 'mysql',
       table      => "${database}.*",