From c2637f6f78aef8494b172cbc4beea71153ca10e0 Mon Sep 17 00:00:00 2001 From: BadgerOps Date: Wed, 3 May 2017 14:56:01 -0600 Subject: [PATCH 1/2] fix host file update path --- lib/vagrant-hostmanager/hosts_file/updater.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-hostmanager/hosts_file/updater.rb b/lib/vagrant-hostmanager/hosts_file/updater.rb index fdae4d9..8e91ce8 100644 --- a/lib/vagrant-hostmanager/hosts_file/updater.rb +++ b/lib/vagrant-hostmanager/hosts_file/updater.rb @@ -41,7 +41,7 @@ module VagrantPlugins if update_file(file, machine, false, line_endings) # upload modified file and remove temporary file - machine.communicate.upload(file.to_s, '/tmp/hosts') + machine.communicate.upload(file.to_s, "/tmp/hosts/hosts.#{machine.name}") if windir machine.communicate.sudo("mv -force /tmp/hosts/hosts.#{machine.name} #{realhostfile}") else From 84d2f9e4be2775121f7658fa36851091f6d3c43d Mon Sep 17 00:00:00 2001 From: BadgerOps Date: Thu, 4 May 2017 12:27:07 -0600 Subject: [PATCH 2/2] fix host file management to be windows and linux compatible --- lib/vagrant-hostmanager/hosts_file/updater.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vagrant-hostmanager/hosts_file/updater.rb b/lib/vagrant-hostmanager/hosts_file/updater.rb index 8e91ce8..97f827f 100644 --- a/lib/vagrant-hostmanager/hosts_file/updater.rb +++ b/lib/vagrant-hostmanager/hosts_file/updater.rb @@ -41,11 +41,11 @@ module VagrantPlugins if update_file(file, machine, false, line_endings) # upload modified file and remove temporary file - machine.communicate.upload(file.to_s, "/tmp/hosts/hosts.#{machine.name}") + machine.communicate.upload(file.to_s, "/tmp/hosts.#{machine.name}") if windir - machine.communicate.sudo("mv -force /tmp/hosts/hosts.#{machine.name} #{realhostfile}") + machine.communicate.sudo("mv -force /tmp/hosts.#{machine.name} #{realhostfile}") else - machine.communicate.sudo("cat /tmp/hosts > #{realhostfile}") + machine.communicate.sudo("cat /tmp/hosts.#{machine.name} > #{realhostfile} && rm /tmp/hosts.#{machine.name}") end end