Permalink
Browse files

Merge pull request #32 from jcam/master

COOK-2561: mysql_database_user can't set global grants
  • Loading branch information...
2 parents fce02ad + ad8bd18 commit c9784cfc5abb2e7ec7fb524fb59a1bab86d1890b @jtimberman jtimberman committed Mar 24, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 libraries/provider_database_mysql_user.rb
@@ -64,7 +64,7 @@ def action_grant
password = "'#{@new_resource.password}'"
filtered = '[FILTERED]'
end
- grant_statement = "GRANT #{@new_resource.privileges.join(', ')} ON #{@new_resource.database_name ? "`#{@new_resource.database_name}`" : '*'}.#{@new_resource.table ? "`#{@new_resource.table}`" : '*'} TO `#{@new_resource.username}`@`#{@new_resource.host}` IDENTIFIED BY "
+ grant_statement = "GRANT #{@new_resource.privileges.join(', ')} ON #{@new_resource.database_name && @new_resource.database_name != '*' ? "`#{@new_resource.database_name}`" : '*'}.#{@new_resource.table && @new_resource.table != '*' ? "`#{@new_resource.table}`" : '*'} TO `#{@new_resource.username}`@`#{@new_resource.host}` IDENTIFIED BY "
Chef::Log.info("#{@new_resource}: granting access with statement [#{grant_statement}#{filtered}]")
db.query(grant_statement + password)
@new_resource.updated_by_last_action(true)

0 comments on commit c9784cf

Please sign in to comment.