@current_resource = Chef::Resource::MysqlDatabase.new(new_resource.name)
@current_resource.database(new_resource.database)
- if mysql_database = @mysql.databases[@current_resource.database]
+ if (mysql_database = @mysql.databases[@current_resource.database])
@current_resource.permissions(mysql_database[:permissions])
end
@current_resource
end]
@current_resource.permissions.each_key do |user|
- unless new_permissions[user]
- converge_by("revoke all for #{user} on #{new_resource}") do
- Chef::Log.info("Revoking all for #{user} on #{new_resource}")
- @mysql.execute(:command => "REVOKE ALL ON `#{new_resource.database}`.* FROM #{user}")
- end
+ next if new_permissions[user]
+
+ converge_by("revoke all for #{user} on #{new_resource}") do
+ Chef::Log.info("Revoking all for #{user} on #{new_resource}")
+ @mysql.execute(:command => "REVOKE ALL ON `#{new_resource.database}`.* FROM #{user}")
end
end