Class: VagrantPlugins::Skytap::Action::RunEnvironment
- Includes:
- ActionHelpers
- Defined in:
- lib/vagrant-skytap/action/run_environment.rb
Overview
Runs multiple VMs in parallel. Ensures that the REST call happens only once.
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ RunEnvironment
constructor
A new instance of RunEnvironment.
- #vm_ids_to_run ⇒ Object
Methods included from ActionHelpers
Constructor Details
#initialize(app, env) ⇒ RunEnvironment
Returns a new instance of RunEnvironment.
36 37 38 39 40 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 36 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.
34 35 36 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 34 def env @env end |
Instance Method Details
#call(env) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 42 def call(env) environment = env[:environment] vm_ids = vm_ids_to_run if current_vm(env).id == vm_ids.first env[:ui].info(I18n.t("vagrant_skytap.running_environment")) @logger.info("Running VMs: #{vm_ids}") environment.run!(vm_ids) end @app.call(env) end |
#vm_ids_to_run ⇒ Object
55 56 57 |
# File 'lib/vagrant-skytap/action/run_environment.rb', line 55 def vm_ids_to_run @env[:initial_states].reject{|id, state| state == :running}.keys end |