Plugin convert_grants_to_resources
In: /vagrant/modules/undine_percona/lib/puppet/parser/functions/convert_grants_to_resources.rb

Function: convert_grants_to_resources

A helper function used by Undine to convert a hash of arrays in database => permissions format to a hash of hashes to be converted to exec resources for a given username.

Parameters

username
The username to GRANT permissions to.
grants
A hash of arrays, keyed by database names and containing an array of MySQL privileges to GRANT via an exec resource later.
su_user
The super user that will GRANT the privileges.
su_pass
The password for the super user that will GRANT the privileges.

Returns

Returns a hash of hashes compatible with create_resources(exec, …) representing the permissions granted to username for each database named in grants.

Examples

GRANTs the CREATE, UPDATE, and DELETE permissions on my_database to my_user.

  $grants = {
    'my_database' => [
      'CREATE',
      'UPDATE',
      'DELETE',
    ],
  }
  $exec_hash = convert_grants_to_resources('my_user', $grants)
  create_resources(exec, $exec_hash)

Type

function

[Validate]