Class: VagrantPlugins::HP::Action::HaltServer
- Inherits:
-
Object
- Object
- VagrantPlugins::HP::Action::HaltServer
- Defined in:
- lib/vagrant-hp/action/halt_server.rb
Overview
This deletes the running server, if there is one.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ HaltServer
constructor
A new instance of HaltServer.
Constructor Details
#initialize(app, env) ⇒ HaltServer
Returns a new instance of HaltServer.
13 14 15 16 |
# File 'lib/vagrant-hp/action/halt_server.rb', line 13 def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_hp::action::delete_server') end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-hp/action/halt_server.rb', line 18 def call(env) if env[:machine].id @logger.info(I18n.t('vagrant_hp.deleting_server')) server = env[:hp_compute].servers.get(env[:machine].id) server.stop # verify this env[:machine].id = nil end @app.call(env) end |