guests/linux: Emit upstart event `vagrant-mounted` also on NFS mounts

Complements #2502, and fixes error on VMs without upstart (like #2596).
This commit is contained in:
Teemu Matilainen 2013-12-22 08:46:24 -03:00
parent ca24e0a516
commit 2fab268ede
2 changed files with 6 additions and 19 deletions

View File

@ -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

View File

@ -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