Skip to content

Commit

Permalink
corrected the chkpass recipe and added recipes for citext and cube ex…
Browse files Browse the repository at this point in the history
…tensions
  • Loading branch information
Ines Sombra committed Oct 10, 2011
1 parent d6cb5ad commit b6f43c1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
13 changes: 8 additions & 5 deletions cookbooks/main/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@
#require_recipe "mysql_administrative_tools"

#enable contrib modules for a given Postgresql9 database
# if ['solo','db_master'].include?(node[:instance_role])
# postgresql9_autoexplain "postgres_test"
# postgresql9_chkpass "postgres_test"
# postgresql9_postgis "postgres_test"
# end
if ['solo','db_master', 'db_slave'].include?(node[:instance_role])
# postgresql9_autoexplain "postgres_test"
# postgresql9_chkpass "postgres_test"
# postgresql9_postgis "postgres_test"
postgresql9_citext "postgres_test"
# postgresql9_cube "postgres_test"

end
1 change: 1 addition & 0 deletions cookbooks/postgresql9_contrib/definitions/chkpass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

load_sql_file do
db_name dbname_to_use
username "postgres"
filename "/usr/share/postgresql-9.0/contrib/chkpass.sql"
end

Expand Down
10 changes: 10 additions & 0 deletions cookbooks/postgresql9_contrib/definitions/citext.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
define :postgresql9_citext do
dbname_to_use = params[:name]

load_sql_file do
db_name dbname_to_use
username "postgres"
filename "/usr/share/postgresql-9.0/contrib/citext.sql"
end

end
10 changes: 10 additions & 0 deletions cookbooks/postgresql9_contrib/definitions/cube.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
define :postgresql9_cube do
dbname_to_use = params[:name]

load_sql_file do
db_name dbname_to_use
username "postgres"
filename "/usr/share/postgresql-9.0/contrib/cube.sql"
end

end
8 changes: 5 additions & 3 deletions cookbooks/postgresql9_contrib/definitions/load_sql_file.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
define :load_sql_file, :db_name => nil, :filename => nil do
define :load_sql_file, :db_name => nil, :filename => nil, :username => "deploy" do
db_name = params[:db_name]
filename = params[:filename]
userperms = params[:username]

execute "Postgresql loading file #{filename}" do
command "psql -U deploy -d #{db_name} -f #{filename}"
execute "Postgresql loading file #{filename} on database #{db_name}" do
command "psql -U #{userperms} -d #{db_name} -f #{filename}"
# Chef::Log.info "psql -U #{userperms} -d #{db_name} -f #{filename}"
end
end

0 comments on commit b6f43c1

Please sign in to comment.