]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/providers/table.rb
Add cookbook for blogs.openstreetmap.org
[chef.git] / cookbooks / postgresql / providers / table.rb
index f162347ddab5fcec9e88bbde57372dc75145c120..495bf8b71e7d9368c25daeaa47cc255e53b1e890 100644 (file)
@@ -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