Class: VagrantPlugins::Skytap::Action::CreateEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/action/create_environment.rb

Overview

Creates an environment from the template URL present in the config file. Stores the new environment URL in the environment properties.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ CreateEnvironment

Returns a new instance of CreateEnvironment.



22
23
24
25
26
# File 'lib/vagrant-skytap/action/create_environment.rb', line 22

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

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



20
21
22
# File 'lib/vagrant-skytap/action/create_environment.rb', line 20

def env
  @env
end

Instance Method Details

#call(env) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/vagrant-skytap/action/create_environment.rb', line 28

def call(env)
  environment = API::Environment.create!(env, vm_url)
  env[:environment] = environment
  environment.properties.write('url' => environment.url)
  env[:machine].id = environment.vms.first.id
  environment.wait_until_ready

  @app.call(env)
end

#vm_urlObject



38
39
40
# File 'lib/vagrant-skytap/action/create_environment.rb', line 38

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