Module: SshCommand
- Defined in:
- lib/cloudstack-client/ssh_command.rb
Class Method Summary collapse
Class Method Details
.run(connection, *commands) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/cloudstack-client/ssh_command.rb', line 4 def SshCommand.run(connection, *commands) ENV['HOME'] = File.dirname(__FILE__) # fixes "non-absolute home" exceptions output = "" Net::SSH.start(connection[:host], connection[:username], :password => connection[:password]) do |session| commands.each do |cmd| output = session.exec!("source ~/.bash_profile && " + cmd) yield output if block_given? end end output end |