Class: VagrantPlugins::Memset::Action::ReadState

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-memset/action/read_state.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ReadState

Returns a new instance of ReadState.



6
7
8
# File 'lib/vagrant-memset/action/read_state.rb', line 6

def initialize (app,env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vagrant-memset/action/read_state.rb', line 10

def call (env)

  return "not created" if env[:machine].id.nil?
  status = env[:memset_compute].call("service.info", {:name => "#{env[:machine].id}"})
  env[:machine_state_id] = status["status"]
  if not status["status"] == "LIVE"
    env[:machine].id = nil
  end

  @app.call(env)
end