Add quote to username and host in mysql_grant constructor

The quote is need for username and host in mysql grant. revoke and grant function is already doing it with cmd_user(). not sure why the constructor didn't do it. This patch fixed #261 and #262.
This commit is contained in:
Pan 2013-09-18 17:04:36 -07:00
parent 52fb70ebde
commit 58b7dc2c87

View file

@ -6,7 +6,8 @@ Puppet::Type.type(:mysql_grant).provide(:mysql, :parent => Puppet::Provider::Mys
def self.instances
instances = []
users.select{ |user| user =~ /.+@/ }.collect do |user|
query = "SHOW GRANTS FOR #{user};"
user_string = "'#{user.sub('@', "'@'")}'"
query = "SHOW GRANTS FOR #{user_string};"
grants = mysql([defaults_file, "-NBe", query].compact)
# Once we have the list of grants generate entries for each.
grants.each_line do |grant|