synced_folder: Emit vagrant-mounted upstart event when starting containers

Closes GH-302
This commit is contained in:
Fabio Rehm 2014-09-22 23:43:55 -03:00
parent 5e155ec02e
commit 5fa6f0dd09
2 changed files with 25 additions and 1 deletions

View file

@ -1,4 +1,4 @@
## [1.0.0](https://github.com/fgrehm/vagrant-lxc/compare/v1.0.0.alpha.3...v1.0.0) (Sep 22, 2014) ## [1.0.0](https://github.com/fgrehm/vagrant-lxc/compare/v1.0.0.alpha.3...v1.0.0) (Sep 23, 2014)
BACKWARDS INCOMPATIBILITIES: BACKWARDS INCOMPATIBILITIES:
@ -8,9 +8,12 @@ BACKWARDS INCOMPATIBILITIES:
IMPROVEMENTS: IMPROVEMENTS:
- `vagrant-mounted` upstart event is now emited on containers that support it [[GH-302]]
- Add support for specifying the `--strip-parameters` used by the [default template](scripts/lxc-template) - Add support for specifying the `--strip-parameters` used by the [default template](scripts/lxc-template)
when extracting rootfs tarballs [[GH-311]] when extracting rootfs tarballs [[GH-311]]
[GH-302]: https://github.com/fgrehm/vagrant-lxc/issues/302
BUG FIXES: BUG FIXES:
- Check for outdated base boxes when starting containers [[GH-314]] - Check for outdated base boxes when starting containers [[GH-314]]

View file

@ -46,6 +46,27 @@ module Vagrant
guest_path: data[:guestpath])) guest_path: data[:guestpath]))
end end
end end
def enable(machine, folders, _opts)
# Emit an upstart event if we can
return unless machine.communicate.test("test -x /sbin/initctl")
# short guestpaths first, so we don't step on ourselves
folders = folders.sort_by do |id, data|
if data[:guestpath]
data[:guestpath].length
else
# A long enough path to just do this at the end.
10000
end
end
folders.each do |id, data|
guest_path = data[:guestpath]
machine.communicate.sudo(
"/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{guest_path}")
end
end
end end
end end
end end