Module: VagrantPlugins::Hosts::GuestCapability::Linux::UpdateHostsEntry
- Defined in:
- lib/vagrant-hosts/guest_capability/linux/update_hosts_entry.rb
Class Method Summary collapse
Class Method Details
.update_hosts_entry(machine, ip, name) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/vagrant-hosts/guest_capability/linux/update_hosts_entry.rb', line 6 def self.update_hosts_entry(machine, ip, name) machine.communicate.tap do |comm| comm.sudo("cat /etc/hosts | grep -v '#{name} \#VAGRANTHOSTS$' >>/etc/hosts.tmp") comm.sudo("mv /etc/hosts.tmp /etc/hosts") comm.sudo("echo '#{ip} #{name} \#VAGRANTHOSTS' >>/etc/hosts") end end |