Class: Vagrant::Config::SSHConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#instance_variables_hash, json_create, #merge, #set_options, #to_hash, #to_json

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

#guest_portObject

Returns the value of attribute guest_port.



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

def guest_port
  @guest_port
end

#hostObject

Returns the value of attribute host.



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

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

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#portObject

Returns the value of attribute port.



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

def port
  @port
end

#private_key_pathObject

Returns the value of attribute private_key_path.



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

def private_key_path
  @private_key_path
end

#shellObject

Returns the value of attribute shell.



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

def shell
  @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.



4
5
6
# File 'lib/vagrant/config/ssh.rb', line 4

def username
  @username
end

Instance Method Details

#validate(env, errors) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/vagrant/config/ssh.rb', line 16

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?(File.expand_path(private_key_path, env.root_path))
    errors.add(I18n.t("vagrant.config.ssh.private_key_missing", :path => private_key_path))
  end
end