class VagrantPlugins::OVirtProvider::Action::DestroyVM

Public Class Methods

new(app, env) click to toggle source
# File lib/vagrant-ovirt3/action/destroy_vm.rb, line 7
def initialize(app, env)
  @logger = Log4r::Logger.new("vagrant_ovirt3::action::destroy_vm")
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-ovirt3/action/destroy_vm.rb, line 12
def call(env)
  # Destroy the server, remove the tracking ID
  env[:ui].info(I18n.t("vagrant_ovirt3.destroy_vm"))

  machine = env[:ovirt_compute].servers.get(env[:machine].id.to_s)
  machine.destroy
  env[:machine].id = nil

  @app.call(env)
end