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