diff options
| author | mo khan <mo@mokhan.ca> | 2013-08-09 14:18:00 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-08-09 14:18:00 -0600 |
| commit | 0f5075496d4eca5f4879c82cb360e90b7ac8d52a (patch) | |
| tree | 8952eca4c27be21253eecc4d186c379707cad986 | |
| parent | 690f92d17a2ae743cca49a56c41cdbd2b7e1323e (diff) | |
remove 'run' block syntax in favor of PGPASSWORD environment variable
| -rw-r--r-- | config/recipes/postgresql.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/config/recipes/postgresql.rb b/config/recipes/postgresql.rb index aa8b1dc..7ea9071 100644 --- a/config/recipes/postgresql.rb +++ b/config/recipes/postgresql.rb @@ -38,10 +38,9 @@ namespace :postgresql do filename = "#{rails_env}-#{Time.now.strftime('%Y-%m-%d-%H-%M')}.dump" backup_path = "#{shared_path}/backups" run "mkdir -p #{shared_path}/backups" - run "pg_dump --clean -Fc -h #{postgresql_host} -U #{postgresql_user} -W #{postgresql_database} > #{backup_path}/#{filename}" do |channel, stream, data| - channel.send_data "#{postgresql_password}\n" - end + + run "PGPASSWORD=#{postgresql_password} pg_dump -Fc --no-acl --no-owner -h #{postgresql_host} -U #{postgresql_user} #{postgresql_database} > #{backup_path}/#{filename}" download("#{backup_path}/#{filename}", "tmp/#{filename}", :via => :scp) - run_locally "cd tmp; ln -s #{filename} database.dump" + run_locally "cd tmp; rm database.dump; ln -s #{filename} database.dump" end end |
