class NodeSpec::CommunicationAdapters::SshCommunicator
Attributes
session[R]
Public Class Methods
new(host, options = {})
click to toggle source
# File lib/nodespec/communication_adapters/ssh_communicator.rb, line 11 def initialize(host, options = {}) @host = host @ssh_options = Net::SSH.configuration_for(@host) @user = options['user'] || @ssh_options[:user] %w[port password keys].each do |param| @ssh_options[param.to_sym] = options[param] if options[param] end end
Public Instance Methods
backend()
click to toggle source
# File lib/nodespec/communication_adapters/ssh_communicator.rb, line 36 def backend :ssh end
backend_proxy()
click to toggle source
# File lib/nodespec/communication_adapters/ssh_communicator.rb, line 32 def backend_proxy BackendProxy.create(:ssh, @session) end
init_session(configuration)
click to toggle source
# File lib/nodespec/communication_adapters/ssh_communicator.rb, line 20 def init_session(configuration) configuration.unbind_winrm_session @session = configuration.bind_ssh_session_for({host: @host, port: @ssh_options[:port]}) do msg = "\nConnecting to #{@host}" msg << ":#{@ssh_options[:port]}" if @ssh_options[:port] msg << " as #{@user}..." verbose_puts msg Net::SSH.start(@host, @user, @ssh_options) end end