Class: VagrantPlugins::ProviderOpenStack::Action::Delete

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-openstack/action/delete.rb

Overview

This action reads the state of the machine and puts it in the ‘:machine_state_id` key in the environment.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Delete

Returns a new instance of Delete.



9
10
11
12
# File 'lib/vagrant-openstack/action/delete.rb', line 9

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_openstack::action::delete")
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-openstack/action/delete.rb', line 14

def call(env)
  os = env[:os_connection]
  server = os.servers.get(env[:machine].id)

  env[:ui].info(I18n.t("vagrant_openstack.deleting"))
  server.destroy
  env[:machine].id = nil

  @app.call(env)
end