Class: VagrantPlugins::OpenNebulaProvider::Action::Destroy

Inherits:
Object
  • Object
show all
Defined in:
lib/opennebula-provider/action/destroy.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Destroy

Returns a new instance of Destroy.



5
6
7
8
# File 'lib/opennebula-provider/action/destroy.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant::provider::opennebula::destroy')
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/opennebula-provider/action/destroy.rb', line 10

def call(env)
  @logger.info I18n.t('opennebula_provider.info.destroying', machine: env[:machine].id)
  driver = env[:machine].provider.driver
  driver.delete(env[:machine].id)
  env[:machine].id = nil
  @app.call(env)
end