Class: VagrantPlugins::VSphere::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/vSphere/provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(machine) ⇒ Provider

Returns a new instance of Provider.



6
7
8
# File 'lib/vSphere/provider.rb', line 6

def initialize(machine)
  @machine = machine
end

Instance Method Details

#action(name) ⇒ Object



10
11
12
13
14
# File 'lib/vSphere/provider.rb', line 10

def action(name)
  action_method = "action_#{name}"
  return Action.send(action_method) if Action.respond_to?(action_method)
  nil
end

#ssh_infoObject



16
17
18
19
# File 'lib/vSphere/provider.rb', line 16

def ssh_info
  env = @machine.action('get_ssh_info')
  env[:machine_ssh_info]
end

#stateObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vSphere/provider.rb', line 21

def state
  env = @machine.action('get_state')

  state_id = env[:machine_state_id]

  short = "vagrant_vsphere.states.short_#{state_id}"
  long  = "vagrant_vsphere.states.long_#{state_id}"

  # Return the MachineState object
  Vagrant::MachineState.new(state_id, short, long)
end

#to_sObject



33
34
35
36
# File 'lib/vSphere/provider.rb', line 33

def to_s
  id = @machine.id.nil? ? 'new' : @machine.id
  "vSphere (#{id})"
end