From 49ff17b9b925e947cdc18c51ff2607613716238f Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 22 Apr 2015 09:18:34 -0400 Subject: [PATCH] Check Upstart is running before emitting upstart events. Fixes issue #5377. Check that Upstart is not just installed but currently actively running before attempting to emit an event after mounting shared folders. Only requires the binary be named upstart, not that it lives in /sbin. --- plugins/guests/linux/cap/mount_nfs.rb | 2 +- plugins/guests/linux/cap/mount_smb_shared_folder.rb | 2 +- plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/guests/linux/cap/mount_nfs.rb b/plugins/guests/linux/cap/mount_nfs.rb index 9fbb72d47..ecc3ea9ee 100644 --- a/plugins/guests/linux/cap/mount_nfs.rb +++ b/plugins/guests/linux/cap/mount_nfs.rb @@ -33,7 +33,7 @@ module VagrantPlugins end # Emit an upstart event if we can - if machine.communicate.test("test -x /sbin/initctl") + if machine.communicate.test("test -x /sbin/initctl && test 'upstart' = $(basename $(sudo readlink /proc/1/exe))") machine.communicate.sudo( "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}") end diff --git a/plugins/guests/linux/cap/mount_smb_shared_folder.rb b/plugins/guests/linux/cap/mount_smb_shared_folder.rb index 424982520..58e7d8950 100644 --- a/plugins/guests/linux/cap/mount_smb_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_smb_shared_folder.rb @@ -82,7 +82,7 @@ module VagrantPlugins end # Emit an upstart event if we can - if machine.communicate.test("test -x /sbin/initctl") + if machine.communicate.test("test -x /sbin/initctl && test 'upstart' = $(basename $(sudo readlink /proc/1/exe))") machine.communicate.sudo( "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}") end diff --git a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb index 83c197d92..56c864b6b 100644 --- a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb @@ -80,7 +80,7 @@ module VagrantPlugins end # Emit an upstart event if we can - if machine.communicate.test("test -x /sbin/initctl") + if machine.communicate.test("test -x /sbin/initctl && test 'upstart' = $(basename $(sudo readlink /proc/1/exe))") machine.communicate.sudo( "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{expanded_guest_path}") end