X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/9bca5f05185dde08efcf2d5f1a2bf66c8cdc9f00..a90448a8d5564aadb3fcc60489cde17ed62c1976:/cookbooks/postgresql/providers/table.rb diff --git a/cookbooks/postgresql/providers/table.rb b/cookbooks/postgresql/providers/table.rb index f162347dd..495bf8b71 100644 --- a/cookbooks/postgresql/providers/table.rb +++ b/cookbooks/postgresql/providers/table.rb @@ -17,6 +17,8 @@ # limitations under the License. # +use_inline_resources + def load_current_resource @pg = Chef::PostgreSQL.new(new_resource.cluster) @tables = @pg.tables(new_resource.database) @@ -67,12 +69,10 @@ action :create do @pg.execute(:command => "GRANT #{privilege.to_s.upcase} ON #{@name} TO \"#{user}\"", :database => new_resource.database) end end - else - if current_privileges.include?(privilege) - converge_by("revoke #{privilege} for #{user} on #{new_resource}") do - Chef::Log.info("Revoking #{privilege} for #{user} on #{new_resource}") - @pg.execute(:command => "REVOKE #{privilege.to_s.upcase} ON #{@name} FROM \"#{user}\"", :database => new_resource.database) - end + elsif current_privileges.include?(privilege) + converge_by("revoke #{privilege} for #{user} on #{new_resource}") do + Chef::Log.info("Revoking #{privilege} for #{user} on #{new_resource}") + @pg.execute(:command => "REVOKE #{privilege.to_s.upcase} ON #{@name} FROM \"#{user}\"", :database => new_resource.database) end end end