Class: VagrantPlugins::Brightbox::Action::ForcedHalt

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

Overview

This halts the running server via the api

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ForcedHalt

Returns a new instance of ForcedHalt.



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

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

Instance Method Details

#call(env) ⇒ Object



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

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

	  if server.ready?
	    # Stop the server.
	    env[:ui].info(I18n.t("vagrant_brightbox.stopping_server"))
	    server.stop
	  end

  @app.call(env)
end