Use the new communication interface for Ubuntu guest
This commit is contained in:
parent
b328e95045
commit
1efee6edcb
|
@ -10,15 +10,17 @@ module VagrantPlugins
|
|||
super
|
||||
|
||||
# Emit an upstart event if upstart is available
|
||||
vm.channel.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
|
||||
vm.communicate.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{guestpath}")
|
||||
end
|
||||
|
||||
def change_host_name(name)
|
||||
if !vm.channel.test("sudo hostname | grep '#{name}'")
|
||||
vm.channel.sudo("sed -i 's/.*$/#{name}/' /etc/hostname")
|
||||
vm.channel.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||
vm.channel.sudo("service hostname start")
|
||||
vm.channel.sudo("hostname --fqdn > /etc/mailname")
|
||||
vm.communicate.tap do |comm|
|
||||
if !comm.test("sudo hostname | grep '#{name}'")
|
||||
comm.sudo("sed -i 's/.*$/#{name}/' /etc/hostname")
|
||||
comm.sudo("sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||
comm.sudo("service hostname start")
|
||||
comm.sudo("hostname --fqdn > /etc/mailname")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue