Class: VagrantPlugins::Brightbox::Action::StartServer

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

Overview

This starts the server via the api

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ StartServer

Returns a new instance of StartServer.



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

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

Instance Method Details

#call(env) ⇒ Object



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

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

	  # Make the action idempotent
	  unless server.ready?
	    # start the server.
	    env[:ui].info(I18n.t("vagrant_brightbox.starting_server"))
	    server.start
	  end

  @app.call(env)
end