]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/mysql/libraries/mysql.rb
Configure database for logical replication
[chef.git] / cookbooks / mysql / libraries / mysql.rb
index 516c38a41b88571e3e07e700beb4adffac7a6900..a40161be0bbfe52a6b572921c59106f41b4f0e98 100644 (file)
@@ -85,7 +85,9 @@ module OpenStreetMap
     end
 
     def mysql_users
-      @mysql_users ||= query("SELECT * FROM user").each_with_object({}) do |user, users|
+      privilege_columns = USER_PRIVILEGES.collect { |privilege| "#{privilege}_priv" }.join(", ")
+
+      @mysql_users ||= query("SELECT user, host, #{privilege_columns} FROM user").each_with_object({}) do |user, users|
         name = "'#{user[:user]}'@'#{user[:host]}'"
 
         users[name] = USER_PRIVILEGES.each_with_object({}) do |privilege, privileges|