Class: VagrantPlugins::Skytap::Action::AddVmToEnvironment

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ AddVmToEnvironment

Returns a new instance of AddVmToEnvironment.


14
15
16
17
18
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 14

def initialize(app, env)
  @app = app
  @env = env
  @logger = Log4r::Logger.new("vagrant_skytap::action::add_vm_to_environment")
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env


12
13
14
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 12

def env
  @env
end

Instance Method Details

#call(env) ⇒ Object


20
21
22
23
24
25
26
27
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 20

def call(env)
  environment = env[:environment]
  vm = environment.add_vm(vm_url)
  env[:machine].id = vm.id
  environment.wait_until_ready

  @app.call(env)
end

#vm_urlObject


29
30
31
# File 'lib/vagrant-skytap/action/add_vm_to_environment.rb', line 29

def vm_url
  env[:machine].provider_config.vm_url
end