Module: PostgreSQLMethods
- Defined in:
- lib/postgres/recipes/postgres.rb
Instance Method Summary collapse
Instance Method Details
#execute(sql, user) ⇒ Object
7 8 9 |
# File 'lib/postgres/recipes/postgres.rb', line 7 def execute(sql, user) run_with_input "echo '#{sql}' | sudo su --login #{user} --command psql" end |
#handle_postgres_password(user, channel, stream, data) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/postgres/recipes/postgres.rb', line 11 def handle_postgres_password(user, channel, stream, data) logger.info data, "[database on #{channel[:host]} asked for password]" if data =~ /^Password for user #{user}:/ pass = Capistrano::CLI.password_prompt "Enter database password for '#{user}':" channel.send_data "#{pass}\n" end end |