# File lib/deltacloud/runner.rb, line 69 def execute(command) @command = command config = ssh_config(@network, @credentials, @key) begin session = nil # Default timeout for connecting to an instance. # 20 seconds should be OK for most of connections, if you are # experiencing some Exceptions with Timeouts increase this value. # Please keep in mind that the HTTP request timeout is set to 60 # seconds, so you need to fit into this time Timeout::timeout(20) do session = Net::SSH.start(@network.ip, 'root', config) end session.open_channel do |channel| channel.on_data do |ch, data| @result += data end channel.exec(command) session.loop end session.close rescue Exception => e raise InstanceSSHError.new("#{e.class.name}: #{e.message}") ensure # FileUtils.rm(config[:keys].first) rescue nil end Deltacloud::Runner::Response.new(self, @result) end
Generated with the Darkfish Rdoc Generator 2.