Search code examples
vagrantpuppetpuppetlabs-mysql

vagrant puppetlabs-mysql Mysql_grant failed


I want to use vagrant, and I defined the following puppet file: http://pastebin.com/GfJK1ziS

When vagrant tries to install the modules everything works as expected. But when it tries to configure mysql, it always get this error:

 Error: Validation of Mysql_grant[${username}@%/${db_name}.*] failed: name must match user and table parameters

What can I do?

As far as I can tell its due to this line in puppetlabs_mysql module

https://github.com/puppetlabs/puppetlabs-mysql/commit/07b661dcea926981cf5cd1c703a1c982d6eb6ef1

i don't know what i have to change


Solution

  • There is a problem with mysql_grants definition. It fails on the following test:

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

    Error message exactly explains what is wrong. Name of grant resource must match user and table. So change:

      '${username}@%/${db_name}.*' => {
        ...
        table      => "${db_name}.*",
        user       => "${username}@%",
      }
    

    to

      "${username}@%/${db_name}.*" => {
        ...
        table      => "${db_name}.*",
        user       => "${username}@%",
      }
    

    Single quoted strings does not interpolate variables in puppet.

    UPDATE: There are also a lot of style issues. You are mixing single quotes strings, with double quotes strings. Use puppet-lint to improve the style of your code.