From 2fab268edeb5d96a5c161aa2339753c7f8bf48e8 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Sun, 22 Dec 2013 08:46:24 -0300 Subject: [PATCH 1/2] guests/linux: Emit upstart event `vagrant-mounted` also on NFS mounts Complements #2502, and fixes error on VMs without upstart (like #2596). --- plugins/guests/linux/cap/mount_nfs.rb | 6 ++++++ plugins/guests/ubuntu/cap/mount_nfs.rb | 19 ------------------- 2 files changed, 6 insertions(+), 19 deletions(-) delete mode 100644 plugins/guests/ubuntu/cap/mount_nfs.rb diff --git a/plugins/guests/linux/cap/mount_nfs.rb b/plugins/guests/linux/cap/mount_nfs.rb index a3396cf54..aae63125c 100644 --- a/plugins/guests/linux/cap/mount_nfs.rb +++ b/plugins/guests/linux/cap/mount_nfs.rb @@ -31,6 +31,12 @@ module VagrantPlugins machine.communicate.sudo(mount_command, :error_class => Vagrant::Errors::LinuxNFSMountFailed) end + + # Emit an upstart event if we can + if machine.communicate.test("test -x /sbin/initctl") + machine.communicate.sudo( + "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}") + end end end end diff --git a/plugins/guests/ubuntu/cap/mount_nfs.rb b/plugins/guests/ubuntu/cap/mount_nfs.rb deleted file mode 100644 index d808e1cf0..000000000 --- a/plugins/guests/ubuntu/cap/mount_nfs.rb +++ /dev/null @@ -1,19 +0,0 @@ -require Vagrant.source_root.join("plugins/guests/linux/cap/mount_nfs") - -module VagrantPlugins - module GuestUbuntu - module Cap - class MountNFS < GuestLinux::Cap::MountNFS - def self.mount_nfs_folder(machine, ip, folders) - super - - # Emit an upstart events if upstart is available - folders.each do |name, opts| - real_guestpath = machine.guest.capability(:shell_expand_guest_path, opts[:guestpath]) - machine.communicate.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{real_guestpath}") - end - end - end - end - end -end From 572cdeeda9dc83a4b6da76c95aeee17a52698e82 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Sun, 22 Dec 2013 08:55:59 -0300 Subject: [PATCH 2/2] guests/linux: Emit upstart event on VirtualBox using the expanded path --- plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb index 9459a9842..069614ded 100644 --- a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb @@ -73,7 +73,7 @@ module VagrantPlugins # Emit an upstart event if we can if machine.communicate.test("test -x /sbin/initctl") machine.communicate.sudo( - "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{guestpath}") + "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}") end end end