Class: Vagrant::Config::SSHConfig

Inherits:
Base
  • Object
show all
Defined in:
lib/vagrant/config/ssh.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#top

Instance Method Summary collapse

Methods inherited from Base

configures, #env, #instance_variables_hash, json_create, #set_options, #to_hash, #to_json

Constructor Details

#initializeSSHConfig

Returns a new instance of SSHConfig.



16
17
18
# File 'lib/vagrant/config/ssh.rb', line 16

def initialize
  @sudo_shell = "bash"
end

Instance Attribute Details

#forward_agentObject

Returns the value of attribute forward_agent.



12
13
14
# File 'lib/vagrant/config/ssh.rb', line 12

def forward_agent
  @forward_agent
end

#forward_x11Object

Returns the value of attribute forward_x11.



13
14
15
# File 'lib/vagrant/config/ssh.rb', line 13

def forward_x11
  @forward_x11
end

#forwarded_port_keyObject

Returns the value of attribute forwarded_port_key.



8
9
10
# File 'lib/vagrant/config/ssh.rb', line 8

def forwarded_port_key
  @forwarded_port_key
end

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/vagrant/config/ssh.rb', line 7

def host
  @host
end

#max_triesObject

Returns the value of attribute max_tries.



9
10
11
# File 'lib/vagrant/config/ssh.rb', line 9

def max_tries
  @max_tries
end

#private_key_pathObject



20
21
22
# File 'lib/vagrant/config/ssh.rb', line 20

def private_key_path
  File.expand_path(@private_key_path, env.root_path)
end

#sudo_shellObject

Returns the value of attribute sudo_shell.



14
15
16
# File 'lib/vagrant/config/ssh.rb', line 14

def sudo_shell
  @sudo_shell
end

#timeoutObject

Returns the value of attribute timeout.



10
11
12
# File 'lib/vagrant/config/ssh.rb', line 10

def timeout
  @timeout
end

#usernameObject

Returns the value of attribute username.



6
7
8
# File 'lib/vagrant/config/ssh.rb', line 6

def username
  @username
end

Instance Method Details

#validate(errors) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/vagrant/config/ssh.rb', line 24

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

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