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:
parent
ca24e0a516
commit
2fab268ede
|
@ -31,6 +31,12 @@ module VagrantPlugins
|
||||||
machine.communicate.sudo(mount_command,
|
machine.communicate.sudo(mount_command,
|
||||||
:error_class => Vagrant::Errors::LinuxNFSMountFailed)
|
:error_class => Vagrant::Errors::LinuxNFSMountFailed)
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue