Skip to content

Commit

Permalink
(#3028) Fix mysql_grant with MySQL ANSI_QUOTES mode
Browse files Browse the repository at this point in the history
Change mysql_grant provider to ignore/delete double-quotes -- as it does with single quotes and backticks -- in the returned list of existing grants. With ANSI_QUOTES enabled in MySQL's sql_mode, grant identifiers (e.g. database name) are quoted with double-quotes rather than backticks, for example "foo".* vs. `foo`.*. This breaks mysql_grant's evaluation of existing grants and causes it to apply grants with every run.
  • Loading branch information
jhriggs committed Feb 3, 2016
1 parent aa29170 commit 31c17b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/provider/mysql_grant/mysql.rb
Expand Up @@ -25,7 +25,7 @@ def self.instances
# Once we have the list of grants generate entries for each.
grants.each_line do |grant|
# Match the munges we do in the type.
munged_grant = grant.delete("'").delete("`")
munged_grant = grant.delete("'").delete("`").delete('"')
# Matching: GRANT (SELECT, UPDATE) PRIVILEGES ON (*.*) TO ('root')@('127.0.0.1') (WITH GRANT OPTION)
if match = munged_grant.match(/^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)?$/)
privileges, table, user, host, rest = match.captures
Expand Down

0 comments on commit 31c17b0

Please sign in to comment.