Class: VagrantPlugins::Brightbox::Action::DeleteServer

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-brightbox/action/delete_server.rb

Overview

This terminates the running server

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ DeleteServer

Returns a new instance of DeleteServer.



8
9
10
11
# File 'lib/vagrant-brightbox/action/delete_server.rb', line 8

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

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-brightbox/action/delete_server.rb', line 13

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

  # Destroy the server and remove the tracking ID
  env[:ui].info(I18n.t("vagrant_brightbox.deleting_server"))
  server.destroy
  env[:machine].id = nil

  @app.call(env)
end