Class: HashiCorp::VagrantVMwareDesktop::Action::VMXModify
- Inherits:
-
Object
- Object
- HashiCorp::VagrantVMwareDesktop::Action::VMXModify
- Includes:
- Common
- Defined in:
- lib/vagrant-vmware-desktop/action/vmx_modify.rb
Overview
This class modifies the VMX file according to the advanced provider configuration.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ VMXModify
constructor
A new instance of VMXModify.
Methods included from Common
Constructor Details
#initialize(app, env) ⇒ VMXModify
Returns a new instance of VMXModify.
11 12 13 14 |
# File 'lib/vagrant-vmware-desktop/action/vmx_modify.rb', line 11 def initialize(app, env) @app = app @logger = Log4r::Logger.new("hashicorp::provider::vmware::vmx_modify") end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vagrant-vmware-desktop/action/vmx_modify.rb', line 16 def call(env) vmx_changes = env[:machine].provider_config.vmx if vmx_changes.length > 0 @logger.info("Modifying VMX file according to user config...") env[:machine].provider.driver.vmx_modify do |vmx| vmx_changes.each do |key, value| if value.nil? @logger.info(" - Delete: #{key}") vmx.delete(key) else @logger.info(" - Set: #{key} = '#{value}'") vmx[key.to_s.downcase] = value end end end end # Carry on @app.call(env) end |