Sha256: 032cc9ca4de4b44006dc9d3b68c3e61835fd86c59225a420ee916a2d812af471

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

module VagrantPlugins
  module DockerProvider
    module Action
      class CheckRunning
        def initialize(app, env)
          @app = app
        end

        def call(env)
          if env[:machine].state.id == :not_created
            raise Vagrant::Errors::VMNotCreatedError
          end

          if env[:machine].state.id == :stopped
            raise Vagrant::Errors::VMNotRunningError
          end

          # Call the next if we have one (but we shouldn't, since this
          # middleware is built to run with the Call-type middlewares)
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docker-provider-0.1.0 lib/docker-provider/action/check_running.rb