lib/vagrant/ssh.rb
# Opens an SSH connection to this environment's virtual machine and yields
# a Net::SSH object which can be used to execute remote commands.
Opens an SSH connection to this environment's virtual machine and yields
a Net::SSH object which can be used to execute remote commands.
Opens an SSH connection to this environment ' s virtual machine and yields a Net :: SSH object which can be used to execute remote commands .
def execute(opts={})
      check_key_permissions(env.config.ssh.private_key_path)
      opts = opts.dup
      opts[:forward_agent] = true if env.config.ssh.forward_agent
      opts[:port] ||= port
      retryable(:tries => 5, :on => Errno::ECONNREFUSED) do
        Net::SSH.start(env.config.ssh.host,
                       env.config.ssh.username,
                       opts.merge( :keys => [env.config.ssh.private_key_path],
                                   :keys_only => true,
                                   :user_known_hosts_file => [],
                                   :paranoid => false,
                                   :config => false)) do |ssh|
          yield SSH::Session.new(ssh, env)
        end
      end
    rescue Errno::ECONNREFUSED
      raise Errors::SSHConnectionRefused
    end
def execute ( opts = { } ) check_key_permissions ( env . config . ssh . private_key_path ) opts = opts . dup opts [ :forward_agent ] = true if env . config . ssh . forward_agent opts [ :port ] ||= port retryable ( :tries => 5 , :on => Errno :: ECONNREFUSED ) do Net :: SSH . start ( env . config . ssh . host , env . config . ssh . username , opts . merge ( :keys => [ env . config . ssh . private_key_path ] , :keys_only => true , :user_known_hosts_file => [ ] , :paranoid => false , :config => false ) ) do | ssh | yield SSH :: Session . new ( ssh , env ) end end rescue Errno :: ECONNREFUSED raise Errors :: SSHConnectionRefused end
Opens an SSH connection to this environment's virtual machine and yields
a Net::SSH object which can be used to execute remote commands.
Opens an SSH connection to this environment ' s virtual machine and yields a Net :: SSH object which can be used to execute remote commands .
# Check the key permissions to avoid SSH hangs # Merge in any additional options
opts
<not_specific>