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.
34 35 36 37 38 |
# File 'lib/vagrant-skytap/action/store_extra_data.rb', line 34 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.
32 33 34 |
# File 'lib/vagrant-skytap/action/store_extra_data.rb', line 32 def env @env end |
Instance Method Details
#call(env) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vagrant-skytap/action/store_extra_data.rb', line 40 def call(env) entry = machine_index_entry unless entry.extra_data.has_key?('vm_id') entry.extra_data.merge!(provider_extra_data) entry = machine_index.set(entry) end machine_index.release(entry) @app.call(env) end |
#provider_extra_data ⇒ Object
51 52 53 54 55 |
# File 'lib/vagrant-skytap/action/store_extra_data.rb', line 51 def provider_extra_data { 'vm_id' => env[:machine].id } end |