Class: VagrantPlugins::G5K::Action::GetState

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-g5k/action/get_state.rb

Overview

This can be used with “Call” built-in to check if the machine is created and branch in the middleware.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ GetState

Returns a new instance of GetState.



9
10
11
12
# File 'lib/vagrant-g5k/action/get_state.rb', line 9

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

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
# File 'lib/vagrant-g5k/action/get_state.rb', line 14

def call(env)
  machine_state_id = env[:machine].state.id
  @logger.info "machine is in state #{machine_state_id}"
  env[:result] = machine_state_id
  @app.call(env)
end