From 35d89203256fa7e27ab9566d39ad92544b031726 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 25 May 2018 15:11:58 -0700 Subject: [PATCH] Case insensitive switch check and only write sentinel file if not found --- plugins/providers/hyperv/action/configure.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/providers/hyperv/action/configure.rb b/plugins/providers/hyperv/action/configure.rb index f8d1e7d74..30831ac12 100644 --- a/plugins/providers/hyperv/action/configure.rb +++ b/plugins/providers/hyperv/action/configure.rb @@ -24,8 +24,8 @@ module VagrantPlugins if opts[:bridge] @logger.debug("Looking for switch with name or ID: #{opts[:bridge]}") switch = switches.find{ |s| - s["Name"].downcase == opts[:bridge] || - s["Id"].downcase == opts[:bridge] + s["Name"].downcase == opts[:bridge].to_s.downcase || + s["Id"].downcase == opts[:bridge].to_s.downcase } if switch @logger.debug("Found switch - Name: #{switch["Name"]} ID: #{switch["Id"]}") @@ -78,11 +78,13 @@ module VagrantPlugins env[:machine].provider.driver.execute(:configure_vm, options) # Create the sentinel - sentinel.open("w") do |f| - f.write(Time.now.to_i.to_s) + if !sentinel.file? + sentinel.open("w") do |f| + f.write(Time.now.to_i.to_s) + end end - if env[:machine].provider_config.vm_integration_services + if !env[:machine].provider_config.vm_integration_services.empty? env[:ui].detail("Setting VM Integration Services") env[:machine].provider_config.vm_integration_services.each do |key, value|