]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/mysql/providers/user.rb
Rubocop cleanups
[chef.git] / cookbooks / mysql / providers / user.rb
index e027b4f5c27d1b427f5fa1a6a3d56b25831230ed..05fd01eb85caf8cad5ec4973826a463814a8faf1 100644 (file)
@@ -42,17 +42,17 @@ action :create do
   end
 
   Chef::MySQL::USER_PRIVILEGES.each do |privilege|
-    if new_resource.send(privilege) != @current_resource.send(privilege)
-      if new_resource.send(privilege)
-        converge_by("grant #{privilege} for #{new_resource}") do
-          Chef::Log.info("Granting #{privilege} for #{new_resource}")
-          @mysql.execute(:command => "GRANT #{@mysql.privilege_name(privilege)} ON *.* TO #{user}")
-        end
-      else
-        converge_by("revoke #{privilege} for #{new_resource}") do
-          Chef::Log.info("Revoking #{privilege} for #{new_resource}")
-          @mysql.execute(:command => "REVOKE #{@mysql.privilege_name(privilege)} ON *.* FROM #{user}")
-        end
+    next if new_resource.send(privilege) == @current_resource.send(privilege)
+
+    if new_resource.send(privilege)
+      converge_by("grant #{privilege} for #{new_resource}") do
+        Chef::Log.info("Granting #{privilege} for #{new_resource}")
+        @mysql.execute(:command => "GRANT #{@mysql.privilege_name(privilege)} ON *.* TO #{user}")
+      end
+    else
+      converge_by("revoke #{privilege} for #{new_resource}") do
+        Chef::Log.info("Revoking #{privilege} for #{new_resource}")
+        @mysql.execute(:command => "REVOKE #{@mysql.privilege_name(privilege)} ON *.* FROM #{user}")
       end
     end
   end