Sha256: def2b0621c1909aa96a28c80aeacc4fbacd85420b47e2fc75c800323d7611522

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

require 'vagrant/communication/ssh'

module VagrantSshExt
  # Based on https://github.com/mitchellh/vagrant/blob/1-0-stable/lib/vagrant/communication/ssh.rb#L75-L90
  def download(from, to)
    @logger.debug("Downloading: #{from} to #{to}")

    connect do |connection|
      scp = Net::SCP.new(connection)
      scp.download!(from, to)
    end
  rescue Net::SCP::Error => e
    # If we get the exit code of 127, then this means SCP is unavailable.
    raise Errors::SCPUnavailable if e.message =~ /\(127\)/
      # Otherwise, just raise the error up
      raise
  end
end

unless Vagrant::Communication::SSH.public_methods.include?('download')
  Vagrant::Communication::SSH.send :include, VagrantSshExt
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-notify-0.1.0 lib/vagrant-notify/vagrant_ssh_ext.rb