Class: VagrantPlugins::Skytap::Action::StoreExtraData
- 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
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ StoreExtraData
constructor
A new instance of StoreExtraData.
- #provider_extra_data ⇒ Object
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
#env ⇒ Object (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_data ⇒ Object
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 |