Further improvements to our matching - stop trying to guess what

might be the username or hostname and just match the entire thing
no matter what it may be.
This commit is contained in:
Ashley Penney 2013-10-10 13:48:24 -07:00
parent 94c24a4e68
commit 09f42c8bb3

View file

@ -14,7 +14,7 @@ Puppet::Type.type(:mysql_grant).provide(:mysql, :parent => Puppet::Provider::Mys
# Match the munges we do in the type.
munged_grant = grant.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([\w.:]+)@([\w.:\/]+)(\s.*)$/)
if match = munged_grant.match(/^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/)
privileges, table, user, host, rest = match.captures
# Once we split privileges up on the , we need to make sure we
# shortern ALL PRIVILEGES to just all.