Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert to existing bash code pattern to run psql commands

  • Loading branch information...
commit e4e19768a7ee393575f80123c9129b47bfdf7b8b 1 parent ecf7a1d
@davidc-donorschoose davidc-donorschoose authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 recipes/contrib.rb
View
9 recipes/contrib.rb
@@ -29,10 +29,11 @@
# as specified by the node attributes.
if (node['postgresql']['contrib'].attribute?('extensions'))
node['postgresql']['contrib']['extensions'].each do |pg_ext|
- execute "#{pg_ext} extension on template1" do
- command <<-EOC
- sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS #{pg_ext}";
- EOC
+ bash "install-#{pg_ext}-extension" do
+ user 'postgres'
+ code <<-EOH
+ echo "CREATE EXTENSION IF NOT EXISTS #{pg_ext};" | psql -d template1
+ EOH
action :run
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.