module-postgresql/spec/support/postgres_test_utils.rb
2012-12-02 16:41:35 -08:00

15 lines
No EOL
377 B
Ruby

module PostgresTestUtils
def sudo_and_log(vm, cmd)
@logger.debug("Running command: '#{cmd}'")
result = ""
@env.vms[vm].channel.sudo("cd /tmp && #{cmd}") do |ch, data|
result << data
@logger.debug(data)
end
result
end
def sudo_psql_and_log(vm, psql_cmd, user = 'postgres')
sudo_and_log(vm, "su #{user} -c 'psql #{psql_cmd}'")
end
end