Sha256: d4f849dfc4039ff24837a11e691ffdf031a036ee17a7299541ecc548810cd849

Contents?: true

Size: 1.73 KB

Versions: 4

Compression:

Stored size: 1.73 KB

Contents

module Vagrant
  module Config
    class SSHConfig < Base
      attr_accessor :username
      attr_accessor :password
      attr_accessor :host
      attr_accessor :port
      attr_accessor :guest_port
      attr_accessor :max_tries
      attr_accessor :timeout
      attr_accessor :private_key_path
      attr_accessor :forward_agent
      attr_accessor :forward_x11
      attr_accessor :shell

      def initialize
        @shell            = "bash"
        @forward_agent    = false
        @forward_x11      = false
      end

      def forwarded_port_key=(value)
        raise Errors::DeprecationError, :message => <<-MESSAGE
`config.ssh.forwarded_port_key` is now gone. You must now use
`config.ssh.guest_port` which is expected to be the port on the
guest that SSH is listening on. Vagrant will automatically scan
the forwarded ports to look for a forwarded port from this port
and use it.
        MESSAGE
      end

      def forwarded_port_destination=(value)
        raise Errors::DeprecationError, :message => <<-MESSAGE
`config.ssh.forwarded_port_destination` is now gone. You must now use
`config.ssh.guest_port` which is expected to be the port on the
guest that SSH is listening on. Vagrant will automatically scan
the forwarded ports to look for a forwarded port from this port
and use it.
        MESSAGE
      end

      def validate(env, errors)
        [:username, :host, :max_tries, :timeout].each do |field|
          errors.add(I18n.t("vagrant.config.common.error_empty", :field => field)) if !instance_variable_get("@#{field}".to_sym)
        end

        if private_key_path && !File.file?(private_key_path)
          errors.add(I18n.t("vagrant.config.ssh.private_key_missing", :path => private_key_path))
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrantup-0.9.1 lib/vagrant/config/ssh.rb
vagrantup-0.9.0 lib/vagrant/config/ssh.rb
vagrant-0.9.1 lib/vagrant/config/ssh.rb
vagrant-0.9.0 lib/vagrant/config/ssh.rb