Merge pull request #234 from BadgerOps/master

Fix host file management for Linux and Windows hosts
This commit is contained in:
Seth Reeser 2017-07-11 12:27:48 -04:00 committed by GitHub
commit d66055782b
1 changed files with 3 additions and 3 deletions

View File

@ -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')
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