From 1efee6edcb110b0c11272bc86c0df245f6fd7a79 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 20 Aug 2012 12:15:42 -0700 Subject: [PATCH] Use the new communication interface for Ubuntu guest --- plugins/guests/ubuntu/guest.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/guests/ubuntu/guest.rb b/plugins/guests/ubuntu/guest.rb index 3999aef7e..76d768f41 100644 --- a/plugins/guests/ubuntu/guest.rb +++ b/plugins/guests/ubuntu/guest.rb @@ -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