Class: VagrantPlugins::VSphere::Action::PowerOn

Inherits:
Object
  • Object
show all
Includes:
Util::MachineHelpers, Util::VimHelpers
Defined in:
lib/vSphere/action/power_on.rb

Instance Method Summary collapse

Methods included from Util::MachineHelpers

#wait_for_ssh

Methods included from Util::VimHelpers

#get_customization_spec_info_by_name, #get_datacenter, #get_datastore, #get_resource_pool, #get_vm_by_uuid

Constructor Details

#initialize(app, env) ⇒ PowerOn

Returns a new instance of PowerOn.



13
14
15
# File 'lib/vSphere/action/power_on.rb', line 13

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vSphere/action/power_on.rb', line 17

def call(env)
  vm = get_vm_by_uuid env[:vSphere_connection], env[:machine]

  env[:ui].info I18n.t('vsphere.power_on_vm')
  vm.PowerOnVM_Task.wait_for_completion
  
  # wait for SSH to be available 
  wait_for_ssh env
  
  @app.call env
end