Sha256: d376e219cb6c6e5f94aee8fb700fbec43feb74f2b29e044074556a1dccc28f6e

Contents?: true

Size: 692 Bytes

Versions: 1

Compression:

Stored size: 692 Bytes

Contents

module VagrantPlugins
  module VCenter
    module Action
      # This class destroy the VM created by the Vagrant provider.
      class Destroy
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new('vagrant_vcenter::action::destroy')
        end

        def call(env)
          cfg = env[:machine].provider_config

          vm = cfg.vmfolder.findByUuid(env[:machine].id) or
               fail Errors::VMNotFound,
                    :vm_name => env[:machine].name

          # Poweron VM
          env[:ui].info('Destroying VM...')
          vm.Destroy_Task.wait_for_completion
          env[:machine].id = nil
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-vcenter-0.3.3 lib/vagrant-vcenter/action/destroy.rb