module Vagrant::Util::GuestHosts::BSD
BSD
specific inspection helpers
Public Instance Methods
replace_host(comm, name, ip)
click to toggle source
Remove any line in /etc/hosts that contains hostname, then add hostname with associated ip
@param [Communicator] @param [String] full hostanme @param [String] target ip
# File lib/vagrant/util/guest_hosts.rb, line 58 def replace_host(comm, name, ip) basename = name.split(".", 2)[0] comm.sudo <<-EOH.gsub(/^ {14}/, '') sed -i.bak '/#{name}/d' /etc/hosts sed -i.bak '1i\\\n#{ip}\t#{name}\t#{basename}\n' /etc/hosts EOH end