]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/resources/user.rb
community: Disable maxmind download for now
[chef.git] / cookbooks / postgresql / resources / user.rb
index 31194fedcac2ac1cce3cbae44a9629f7a7c637b8..6d0e07e4794299fcd627f40f8d6d48012824251c 100644 (file)
@@ -43,6 +43,12 @@ action :create do
     converge_by "create role #{new_resource.user}" do
       cluster.execute(:command => "CREATE ROLE \"#{new_resource.user}\" LOGIN #{password} #{superuser} #{createdb} #{createrole}")
     end
+
+    Array(new_resource.roles).each do |role|
+      converge_by "grant #{role} to #{new_resource.user}" do
+        cluster.execute(:command => "GRANT \"#{role}\" TO \"#{new_resource.user}\"")
+      end
+    end
   else
     current_user = cluster.users[new_resource.user]