Class: Train::Transports::SSH

Inherits:
Object
  • Object
show all
Defined in:
lib/train/transports/ssh.rb,
lib/train/transports/ssh_connection.rb,
lib/train/transports/cisco_ios_connection.rb

Overview

A Transport which uses the SSH protocol to execute commands and transfer files.

Author:

Defined Under Namespace

Classes: CiscoIOSConnection, Connection

Instance Method Summary collapse

Instance Method Details

#connection(state = {}, &block) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/train/transports/ssh.rb', line 74

def connection(state = {}, &block)
  opts = merge_options(options, state || {})
  validate_options(opts)
  conn_opts = connection_options(opts)

  if defined?(@connection) && @connection_options == conn_opts
    reuse_connection(&block)
  else
    create_new_connection(conn_opts, &block)
  end
end