Class: VagrantPlugins::Skytap::Action::AddVmToEnvironment
- Defined in:
- lib/vagrant-skytap/action/add_vm_to_environment.rb
Overview
Adds the specified vm to this Skytap environment, assuming the vm and environment both exist.
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ AddVmToEnvironment
constructor
A new instance of AddVmToEnvironment.
- #vm_url ⇒ Object
Constructor Details
#initialize(app, env) ⇒ AddVmToEnvironment
Returns a new instance of AddVmToEnvironment.
35 36 37 38 39 |
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 35 def initialize(app, env) @app = app @env = env @logger = Log4r::Logger.new("vagrant_skytap::action::add_vm_to_environment") end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
33 34 35 |
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 33 def env @env end |
Instance Method Details
#call(env) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 41 def call(env) environment = env[:environment] vm = API::Vm.fetch(env, vm_url) environment.add_vms([vm]) env[:machine].id = environment.vms.last.id environment.wait_until_ready @app.call(env) end |
#vm_url ⇒ Object
51 52 53 |
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 51 def vm_url env[:machine].provider_config.vm_url end |