X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/2b4843ace5d011913f8e72df157ffd127e9da4a9..31f1fa863c0b208a44e10ef3ae1571024ef0f0ae:/cookbooks/postgresql/resources/user.rb diff --git a/cookbooks/postgresql/resources/user.rb b/cookbooks/postgresql/resources/user.rb index 31194fedc..6d0e07e47 100644 --- a/cookbooks/postgresql/resources/user.rb +++ b/cookbooks/postgresql/resources/user.rb @@ -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]