Class: VagrantPlugins::Skytap::Action::StoreExtraData

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

Overview

Stores some provider-specific data in Vagrant's global machine index.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MixinMachineIndex

#machine_index, #machine_index_entry

Constructor Details

#initialize(app, env) ⇒ StoreExtraData

Returns a new instance of StoreExtraData.


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

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

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env


10
11
12
# File 'lib/vagrant-skytap/action/store_extra_data.rb', line 10

def env
  @env
end

Instance Method Details

#call(env) ⇒ Object


18
19
20
21
22
23
24
25
# File 'lib/vagrant-skytap/action/store_extra_data.rb', line 18

def call(env)
  entry = machine_index_entry
  entry.extra_data.merge!(provider_extra_data)
  entry = machine_index.set(entry)
  machine_index.release(entry)

  @app.call(env)
end

#provider_extra_dataObject


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

def provider_extra_data
  {
    'vm_id' => env[:machine].id
  }
end