Class: VagrantWindows::Config::WinRM

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-windows/config/winrm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWinRM

Returns a new instance of WinRM.



15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-windows/config/winrm.rb', line 15

def initialize
  @username   = UNSET_VALUE
  @password   = UNSET_VALUE
  @host       = UNSET_VALUE
  @port       = UNSET_VALUE
  @guest_port = UNSET_VALUE
  @max_tries  = UNSET_VALUE
  @timeout    = UNSET_VALUE
end

Instance Attribute Details

#guest_portObject

Returns the value of attribute guest_port.



11
12
13
# File 'lib/vagrant-windows/config/winrm.rb', line 11

def guest_port
  @guest_port
end

#hostObject

Returns the value of attribute host.



9
10
11
# File 'lib/vagrant-windows/config/winrm.rb', line 9

def host
  @host
end

#max_triesObject

Returns the value of attribute max_tries.



12
13
14
# File 'lib/vagrant-windows/config/winrm.rb', line 12

def max_tries
  @max_tries
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/vagrant-windows/config/winrm.rb', line 8

def password
  @password
end

#portObject

Returns the value of attribute port.



10
11
12
# File 'lib/vagrant-windows/config/winrm.rb', line 10

def port
  @port
end

#timeoutObject

Returns the value of attribute timeout.



13
14
15
# File 'lib/vagrant-windows/config/winrm.rb', line 13

def timeout
  @timeout
end

#usernameObject

Returns the value of attribute username.



7
8
9
# File 'lib/vagrant-windows/config/winrm.rb', line 7

def username
  @username
end

Instance Method Details

#finalize!Object



38
39
40
41
42
43
44
45
46
# File 'lib/vagrant-windows/config/winrm.rb', line 38

def finalize!
  @username = "vagrant" if @username == UNSET_VALUE
  @password = "vagrant" if @password == UNSET_VALUE
  @host = nil           if @host == UNSET_VALUE
  @port = 5985          if @port == UNSET_VALUE
  @guest_port = 5985    if @guest_port == UNSET_VALUE
  @max_tries = 20       if @max_tries == UNSET_VALUE
  @timeout = 1800       if @timeout == UNSET_VALUE
end

#validate(machine) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vagrant-windows/config/winrm.rb', line 25

def validate(machine)
  errors = []

  errors << "winrm.username cannot be nil."   if machine.config.winrm.username.nil?
  errors << "winrm.password cannot be nil."   if machine.config.winrm.password.nil?
  errors << "winrm.port cannot be nil."       if machine.config.winrm.port.nil?
  errors << "winrm.guest_port cannot be nil." if machine.config.winrm.guest_port.nil?
  errors << "winrm.max_tries cannot be nil."  if machine.config.winrm.max_tries.nil?
  errors << "winrm.timeout cannot be nil."    if machine.config.winrm.timeout.nil?

  { "WinRM" => errors }
end