X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/3a4d52bd4c0f8e6ae7679145846b7bc7845d8ace..21958591555b0b80370e944e3128ac5d533c281d:/cookbooks/mysql/libraries/mysql.rb diff --git a/cookbooks/mysql/libraries/mysql.rb b/cookbooks/mysql/libraries/mysql.rb index 9ddc238c7..2b2bca67d 100644 --- a/cookbooks/mysql/libraries/mysql.rb +++ b/cookbooks/mysql/libraries/mysql.rb @@ -87,17 +87,17 @@ class Chef end def users - @users ||= query("SELECT * FROM user").each_with_object({}) do |users, user| + @users ||= query("SELECT * FROM user").each_with_object({}) do |user, users| name = "'#{user[:user]}'@'#{user[:host]}'" - users[name] = USER_PRIVILEGES.each_with_object({}) do |privileges, privilege| + users[name] = USER_PRIVILEGES.each_with_object({}) do |privilege, privileges| privileges[privilege] = user["#{privilege}_priv".to_sym] == "Y" end end end def databases - @databases ||= query("SHOW databases").each_with_object({}) do |databases, database| + @databases ||= query("SHOW databases").each_with_object({}) do |database, databases| databases[database[:database]] = { :permissions => {} } @@ -107,7 +107,7 @@ class Chef if database = @databases[record[:db]] user = "'#{record[:user]}'@'#{record[:host]}'" - database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privileges, privilege| + database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privilege, privileges| privileges << privilege if record["#{privilege}_priv".to_sym] == "Y" end end