Sha256: 96f5832d2cfb5e1d766cf2fc71e3d0bb8b1ab8747e19c045663b6829d1a0d9e9

Contents?: true

Size: 595 Bytes

Versions: 12

Compression:

Stored size: 595 Bytes

Contents

require "log4r"

module VagrantPlugins
  module G5K
    module Action
      # This can be used with "Call" built-in to check if the machine
      # is created and branch in the middleware.
      class GetState
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant_g5k::action::get_state")
        end

        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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-g5k-0.9.9 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.8 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.7 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.6 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.5 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.4 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.3 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.2 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.1 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.9.0 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.0.18 lib/vagrant-g5k/action/get_state.rb
vagrant-g5k-0.0.17 lib/vagrant-g5k/action/get_state.rb