Method: Toolshed::ServerAdministration::SSH#execute

Defined in:
lib/toolshed/server_administration/ssh.rb

#executeObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/toolshed/server_administration/ssh.rb', line 34

def execute
  begin
    timeout.start do
      Net::SSH.start(host, user, ssh_options) do |ssh|
        ssh.open_channel do |channel|
          self.channel = channel
          request_pty
          run_commands
        end
        ssh.loop
      end
    end
  rescue Toolshed::Timeout::Error => e
    Toolshed.logger.fatal e.message
    raise SSHResponseException, "Unable to handle response for #{data.last}"
  end
  data
end