Skip to content

Commit 31c17b0

Browse files
committed
(#3028) Fix mysql_grant with MySQL ANSI_QUOTES mode
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.
1 parent aa29170 commit 31c17b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/puppet/provider/mysql_grant/mysql.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def self.instances
2525
# Once we have the list of grants generate entries for each.
2626
grants.each_line do |grant|
2727
# Match the munges we do in the type.
28-
munged_grant = grant.delete("'").delete("`")
28+
munged_grant = grant.delete("'").delete("`").delete('"')
2929
# Matching: GRANT (SELECT, UPDATE) PRIVILEGES ON (*.*) TO ('root')@('127.0.0.1') (WITH GRANT OPTION)
3030
if match = munged_grant.match(/^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)?$/)
3131
privileges, table, user, host, rest = match.captures

0 commit comments

Comments
 (0)