Module: Vagrant::Util::GuestHosts::BSD
- Includes:
- Unix
- Defined in:
- lib/vagrant/util/guest_hosts.rb
Overview
BSD specific inspection helpers
Constant Summary
Constants included from Unix
Unix::DEAFAULT_LOOPBACK_CHECK_LIMIT
Instance Method Summary collapse
-
#replace_host(comm, name, ip) ⇒ Object
Remove any line in /etc/hosts that contains hostname, then add hostname with associated ip.
Methods included from Unix
#add_hostname_to_loopback_interface
Instance Method Details
#replace_host(comm, name, ip) ⇒ Object
Remove any line in /etc/hosts that contains hostname, then add hostname with associated ip
61 62 63 64 65 66 67 |
# File 'lib/vagrant/util/guest_hosts.rb', line 61 def replace_host(comm, name, ip) basename = name.split(".", 2)[0] comm.sudo " sed -i.bak '/\#{name}/d' /etc/hosts\n sed -i.bak '1i\\\\\\n\#{ip}\\t\#{name}\\t\#{basename}\\n' /etc/hosts\n EOH\nend\n".gsub(/^ {14}/, '') |