class VagrantPlugins::VSphere::Action::Destroy
Public Class Methods
new(app, _env)
click to toggle source
# File lib/vSphere/action/destroy.rb, line 11 def initialize(app, _env) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/vSphere/action/destroy.rb, line 15 def call(env) destroy_vm env env[:machine].id = nil @app.call env end
Private Instance Methods
destroy_vm(env)
click to toggle source
# File lib/vSphere/action/destroy.rb, line 24 def destroy_vm(env) return if env[:machine].state.id == :not_created vm = get_vm_by_uuid env[:vSphere_connection], env[:machine] return if vm.nil? begin env[:ui].info I18n.t('vsphere.destroy_vm') vm.Destroy_Task.wait_for_completion rescue Errors::VSphereError raise rescue StandardError => e raise Errors::VSphereError.new, e.message end end