Sha256: 65f2339297f02dcf0153d4d74f2ebadecdb15f578593dd92c749ded735093b4c

Contents?: true

Size: 641 Bytes

Versions: 12

Compression:

Stored size: 641 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 IsCreated
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant_g5k::action::is_created")
        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 == :Running or machine_state_id == :Waiting
          @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/is_created.rb
vagrant-g5k-0.9.8 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.7 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.6 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.5 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.4 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.3 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.2 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.1 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.9.0 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.0.18 lib/vagrant-g5k/action/is_created.rb
vagrant-g5k-0.0.17 lib/vagrant-g5k/action/is_created.rb