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

GRANT on FUNCTION does not behave as expected

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: mysql
    • Labels:
      None
    • Environment:

      Debian, Puppet 3.7.5

    • Template:
    • Team:
      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

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

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support