Sha256: 96ae5667d912cd335fab4a7cdee7bc63b674d781a0b77a08855919d301201845

Contents?: true

Size: 1.22 KB

Versions: 19

Compression:

Stored size: 1.22 KB

Contents

require "pathname"

require "vagrant/util/ssh"

module Vagrant
  module Action
    module Builtin
      # This class will exec into a full fledged SSH console into the
      # remote machine. This middleware assumes that the VM is running and
      # ready for SSH, and uses the {Machine#ssh_info} method to retrieve
      # SSH information necessary to connect.
      #
      # Note: If there are any middleware after `SSHExec`, they will **not**
      # run, since exec replaces the currently running process.
      class SSHExec
        # For quick access to the `SSH` class.
        include Vagrant::Util

        def initialize(app, env)
          @app = app
        end

        def call(env)
          # Grab the SSH info from the machine
          info = env[:machine].ssh_info

          # If the result is nil, then the machine is telling us that it is
          # not yet ready for SSH, so we raise this exception.
          raise Errors::SSHNotReady if info.nil?

          if info[:private_key_path]
            # Check the SSH key permissions
            SSH.check_key_permissions(Pathname.new(info[:private_key_path]))
          end

          # Exec!
          SSH.exec(info, env[:ssh_opts])
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/lib/vagrant/action/builtin/ssh_exec.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/lib/vagrant/action/builtin/ssh_exec.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/lib/vagrant/action/builtin/ssh_exec.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/lib/vagrant/action/builtin/ssh_exec.rb
tnargav-1.3.6 lib/vagrant/action/builtin/ssh_exec.rb
tnargav-1.3.3 lib/vagrant/action/builtin/ssh_exec.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/lib/vagrant/action/builtin/ssh_exec.rb
tnargav-1.2.3 lib/vagrant/action/builtin/ssh_exec.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/lib/vagrant/action/builtin/ssh_exec.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/lib/vagrant/action/builtin/ssh_exec.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/lib/vagrant/action/builtin/ssh_exec.rb
tnargav-1.2.2 lib/vagrant/action/builtin/ssh_exec.rb
vagrantup-1.1.3 lib/vagrant/action/builtin/ssh_exec.rb
vagrantup-1.1.2 lib/vagrant/action/builtin/ssh_exec.rb
vagrantup-1.1.1 lib/vagrant/action/builtin/ssh_exec.rb
vagrantup-1.1.0 lib/vagrant/action/builtin/ssh_exec.rb
vagrantup-1.1.4 lib/vagrant/action/builtin/ssh_exec.rb
vagrant-actionio-0.0.9 vendor/bundle/bundler/gems/vagrant-c74251a1d9c0/lib/vagrant/action/builtin/ssh_exec.rb
vagrant-lxc-0.0.1 vendor/vagrant/lib/vagrant/action/builtin/ssh_exec.rb