Class: VagrantPlugins::Skytap::Action::RunEnvironment
- Includes:
- Vagrant::Util::Retryable
- Defined in:
- lib/vagrant-skytap/action/run_environment.rb
Overview
Runs multiple VMs in parallel. This middleware will be invoked for each machine, so we set the :first_machine flag to prevent redundant REST calls.
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #environment ⇒ Object
-
#initialize(app, env) ⇒ RunEnvironment
constructor
A new instance of RunEnvironment.
Constructor Details
#initialize(app, env) ⇒ RunEnvironment
Returns a new instance of RunEnvironment.
14 15 16 17 18 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 14 def initialize(app, env) @app = app @env = env @logger = Log4r::Logger.new("vagrant_skytap::action::run_environment") end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
12 13 14 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 12 def env @env end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 20 def call(env) if env[:first_machine] env[:ui].info(I18n.t("vagrant_skytap.running_environment")) vm_ids = env[:machines].try(:collect, &:id) @logger.info("Running VMs: #{vm_ids}") env[:environment].run!(vm_ids) end @app.call(env) end |
#environment ⇒ Object
31 32 33 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 31 def environment env[:environment] end |