Skip to content

Commit

Permalink
Merge pull request #234 from BadgerOps/master
Browse files Browse the repository at this point in the history
Fix host file management for Linux and Windows hosts
  • Loading branch information
seth-reeser committed Jul 11, 2017
2 parents 06b75cd + 84d2f9e commit d660557
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/vagrant-hostmanager/hosts_file/updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def update_guest(machine)

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

Expand Down

0 comments on commit d660557

Please sign in to comment.