Class: VagrantPlugins::VSphere::Provider
- Inherits:
-
Object
- Object
- VagrantPlugins::VSphere::Provider
- Defined in:
- lib/vSphere/provider.rb
Instance Method Summary collapse
- #action(name) ⇒ Object
-
#initialize(machine) ⇒ Provider
constructor
A new instance of Provider.
- #ssh_info ⇒ Object
- #state ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(machine) ⇒ Provider
Returns a new instance of Provider.
8 9 10 |
# File 'lib/vSphere/provider.rb', line 8 def initialize(machine) @machine = machine end |
Instance Method Details
#action(name) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/vSphere/provider.rb', line 12 def action(name) action_method = "action_#{name}" return Action.send(action_method) if Action.respond_to?(action_method) nil end |
#ssh_info ⇒ Object
19 20 21 22 |
# File 'lib/vSphere/provider.rb', line 19 def ssh_info env = @machine.action('get_ssh_info', lock: false) env[:machine_ssh_info] end |
#state ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vSphere/provider.rb', line 24 def state env = @machine.action('get_state', lock: false) 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_s ⇒ Object
36 37 38 39 |
# File 'lib/vSphere/provider.rb', line 36 def to_s id = @machine.id.nil? ? 'new' : @machine.id "vSphere (#{id})" end |