Class: VagrantPlugins::Rackspace::Action::DeleteServer
- Inherits:
-
Object
- Object
- VagrantPlugins::Rackspace::Action::DeleteServer
- Defined in:
- lib/vagrant-rackspace/action/delete_server.rb
Overview
This deletes the running server, if there is one.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ DeleteServer
constructor
A new instance of DeleteServer.
Constructor Details
#initialize(app, env) ⇒ DeleteServer
Returns a new instance of DeleteServer.
8 9 10 11 |
# File 'lib/vagrant-rackspace/action/delete_server.rb', line 8 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_rackspace::action::delete_server") end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/vagrant-rackspace/action/delete_server.rb', line 13 def call(env) if env[:machine].id env[:ui].info(I18n.t("vagrant_rackspace.deleting_server")) server = env[:rackspace_compute].servers.get(env[:machine].id) server.destroy env[:machine].id = nil end @app.call(env) end |