]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/mysql/libraries/mysql.rb
Rubocop cleanups
[chef.git] / cookbooks / mysql / libraries / mysql.rb
index 2b2bca67d35767b71349058e547cf9799b1bf44a..91eb6f9d1c5527f2c4a36e17505e2ff8ab15a72e 100644 (file)
@@ -104,12 +104,14 @@ class Chef
       end
 
       query("SELECT * FROM db").each do |record|
-        if database = @databases[record[:db]]
-          user = "'#{record[:user]}'@'#{record[:host]}'"
+        database = @databases[record[:db]]
 
-          database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privilege, privileges|
-            privileges << privilege if record["#{privilege}_priv".to_sym] == "Y"
-          end
+        next unless database
+
+        user = "'#{record[:user]}'@'#{record[:host]}'"
+
+        database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privilege, privileges|
+          privileges << privilege if record["#{privilege}_priv".to_sym] == "Y"
         end
       end