Case insensitive switch check and only write sentinel file if not found

This commit is contained in:
Chris Roberts 2018-05-25 15:11:58 -07:00
parent 6c731fb86c
commit 35d8920325
1 changed files with 7 additions and 5 deletions

View File

@ -24,8 +24,8 @@ module VagrantPlugins
if opts[:bridge] if opts[:bridge]
@logger.debug("Looking for switch with name or ID: #{opts[:bridge]}") @logger.debug("Looking for switch with name or ID: #{opts[:bridge]}")
switch = switches.find{ |s| switch = switches.find{ |s|
s["Name"].downcase == opts[:bridge] || s["Name"].downcase == opts[:bridge].to_s.downcase ||
s["Id"].downcase == opts[:bridge] s["Id"].downcase == opts[:bridge].to_s.downcase
} }
if switch if switch
@logger.debug("Found switch - Name: #{switch["Name"]} ID: #{switch["Id"]}") @logger.debug("Found switch - Name: #{switch["Name"]} ID: #{switch["Id"]}")
@ -78,11 +78,13 @@ module VagrantPlugins
env[:machine].provider.driver.execute(:configure_vm, options) env[:machine].provider.driver.execute(:configure_vm, options)
# Create the sentinel # Create the sentinel
sentinel.open("w") do |f| if !sentinel.file?
f.write(Time.now.to_i.to_s) sentinel.open("w") do |f|
f.write(Time.now.to_i.to_s)
end
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[:ui].detail("Setting VM Integration Services")
env[:machine].provider_config.vm_integration_services.each do |key, value| env[:machine].provider_config.vm_integration_services.each do |key, value|