class HashiCorp::VagrantVMwareDesktop::Action::FixOldMachineID

This fixes old-style machine IDs that were set in early versions of the VMware providers.

Public Class Methods

new(app, env) click to toggle source
# File lib/vagrant-vmware-desktop/action/fix_old_machine_id.rb, line 11
def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::fix_old_machine_id")
end

Public Instance Methods

call(env) click to toggle source
# File lib/vagrant-vmware-desktop/action/fix_old_machine_id.rb, line 16
def call(env)
  driver     = env[:machine].provider.driver
  machine_id = env[:machine].id
  if machine_id && driver.vmx_path.to_s != machine_id
    @logger.warn("Old-style ID found. Resetting to VMX path.")
    env[:machine].id = driver.vmx_path.to_s
  end

  @app.call(env)
end