X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/3a4b1c2078cd515e93a5f1bf8967f380fbd1646f..5f2de3518b17b1fb18294649f6c238e289ca7835:/cookbooks/postgresql/providers/table.rb?ds=sidebyside diff --git a/cookbooks/postgresql/providers/table.rb b/cookbooks/postgresql/providers/table.rb index 7bc8cfb02..f162347dd 100644 --- a/cookbooks/postgresql/providers/table.rb +++ b/cookbooks/postgresql/providers/table.rb @@ -26,7 +26,7 @@ def load_current_resource @current_resource.cluster(new_resource.cluster) @current_resource.database(new_resource.database) @current_resource.schema(new_resource.schema) - if pg_table = @tables[@name] + if (pg_table = @tables[@name]) @current_resource.owner(pg_table[:owner]) @current_resource.permissions(pg_table[:permissions]) end @@ -43,11 +43,11 @@ action :create do end @current_resource.permissions.each_key do |user| - unless new_resource.permissions[user] - converge_by("revoke all for #{user} on #{new_resource}") do - Chef::Log.info("Revoking all for #{user} on #{new_resource}") - @pg.execute(:command => "REVOKE ALL ON #{@name} FROM \"#{user}\"", :database => new_resource.database) - end + next if new_resource.permissions[user] + + converge_by("revoke all for #{user} on #{new_resource}") do + Chef::Log.info("Revoking all for #{user} on #{new_resource}") + @pg.execute(:command => "REVOKE ALL ON #{@name} FROM \"#{user}\"", :database => new_resource.database) end end