Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-2075

GRANT on FUNCTION does not behave as expected

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • None
    • mysql
    • None
    • Debian, Puppet 3.7.5

    • Modules

    Description

      When trying to set up a grant for a stored function, puppetlabs-mysql quotes the MySQL command incorrectly. This looks like it was fixed for PROCEDURE grants here: https://tickets.puppetlabs.com/browse/MODULES-130

      There doesn't appear to be a similar fix for FUNCTIONS though. It results in the following error:

      Error: Execution of '/usr/bin/mysql --defaults-extra-file=/root/.my.cnf -e GRANT EXECUTE ON `FUNCTION dbname`.NAME_OF_FUNC TO 'dbuser'@'host' WITH GRANT OPTION' returned 1: ERROR 1144 (42000) at line 1: Illegal GRANT/REVOKE command; please consult the manual to see which privileges can be used
      

      It's simple to see what's gone wrong - it's put the backtick to the left of FUNCTION rather than simply around "dbname".

      My grants section looks as follows:

      grants => {
          'dbuser@localhost/FUNCTION dbname.NAME_OF_FUNC' => {
              ensure     => present,
              options    => ['GRANT'],
              privileges => ['EXECUTE'],
              table      => 'FUNCTION dbname.NAME_OF_FUNC',
              user       => 'dbuser@localhost'
          },
      }
      

      Attachments

        Activity

          People

            jonathan.tripathy Jonny (JT) Tripathy
            n00bsys0p Alex Shepherd
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support