Sha256: 8d68c10d2f40eca4847fa71bf29af51f497154d2b690dc30d3f28e0d26a51d1c

Contents?: true

Size: 462 Bytes

Versions: 13

Compression:

Stored size: 462 Bytes

Contents

module SshCommand
  require 'net/ssh'

  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
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cloudstack-cli-0.1.7 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.6 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.5 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.4 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.3 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.2 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.1 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.1.0 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.0.5 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.0.4 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.0.3 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.0.2 lib/cloudstack-client/ssh_command.rb
cloudstack-cli-0.0.1 lib/cloudstack-client/ssh_command.rb