Class: VagrantPlugins::Blocker::Action::CheckBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_blocker/action/check_block.rb

Overview

Vagrant action that checks for blocking machines

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ CheckBlock

Returns a new instance of CheckBlock.



7
8
9
10
11
# File 'lib/vagrant_blocker/action/check_block.rb', line 7

def initialize(app, env)
  @app = app
  @machine = env[:machine]
  @global_env = @machine.env
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant_blocker/action/check_block.rb', line 13

def call(env)
  # Only do stuff if we want to bring a machine up.
  return @app.call(env) if !env[:machine_action] == :up

  # Aquire active machines and check their blockers.
  @machine.env.active_machines.each do |name, provider|
    test_block_by_running(name)
    test_blocks_running(name, provider)
  end
  @app.call(env)
end