Class: VagrantPlugins::VSphere::Action::PowerOff
- Inherits:
-
Object
- Object
- VagrantPlugins::VSphere::Action::PowerOff
- Includes:
- Util::VimHelpers
- Defined in:
- lib/vSphere/action/power_off.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ PowerOff
constructor
A new instance of PowerOff.
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) ⇒ PowerOff
Returns a new instance of PowerOff.
11 12 13 |
# File 'lib/vSphere/action/power_off.rb', line 11 def initialize(app, env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vSphere/action/power_off.rb', line 15 def call(env) vm = get_vm_by_uuid env[:vSphere_connection], env[:machine] unless vm.nil? env[:ui].info I18n.t('vsphere.power_off_vm') vm.PowerOffVM_Task.wait_for_completion end @app.call env end |