core: add "disable" method for synced folders, deprecate "prepare"

This commit is contained in:
Mitchell Hashimoto 2014-04-16 10:12:59 -07:00
parent c3e6c794cd
commit e119a5714a
3 changed files with 35 additions and 13 deletions

View File

@ -1,5 +1,11 @@
## 1.6.0 (unreleased)
BACKWARDS INCOMPATIBILITIES:
- providers/virtualbox: Shared folders backed by VirtualBox are now
"transient". They will be removed if you reboot outside of Vagrant.
Always use `vagrant reload`.
FEATURES:
- **New guest: Windows**. Vagrant now fully supports Windows as a guest
@ -37,6 +43,11 @@ BUG FIXES:
PLUGIN AUTHOR CHANGES:
- core: The "Call" middleware now merges the resulting middlewaer stack
into the current stack, rather than running it as a separate stack.
The result is that ordering is preserved.
- core: The "Message" middleware now takes a "post" option that will
output the message on the return-side of the middleware stack.
- New host capability: "rdp\_client". This capability gets the RDP connection
info and must launch the RDP client on the system.
- provider: Providers can now specify that boxes are optional. This lets
@ -45,11 +56,8 @@ PLUGIN AUTHOR CHANGES:
- provider: A new class-level `usable?` method can be implemented on the
provider implementation. This returns or raises an error when the
provider is not usable (i.e. VirtualBox isn't installed for VirtualBox)
- core: The "Call" middleware now merges the resulting middlewaer stack
into the current stack, rather than running it as a separate stack.
The result is that ordering is preserved.
- core: The "Message" middleware now takes a "post" option that will
output the message on the return-side of the middleware stack.
- synced\_folders: New "disable" method for removing synced folders from
a running machine.
## 1.5.4 (April 21, 2014)

View File

@ -14,21 +14,36 @@ module Vagrant
def usable?(machine, raise_error=false)
end
# This is called before the machine is booted, allowing the
# implementation to make any machine modifications or perhaps
# verifications.
# DEPRECATED: This will be removed.
#
# No return value.
# @deprecated
def prepare(machine, folders, opts)
end
# This is called after the machine is booted and after networks
# are setup.
#
# This might be called with new folders while the machine is running.
# If so, then this should add only those folders without removing
# any existing ones.
#
# No return value.
def enable(machine, folders, opts)
end
# This is called to remove the synced folders from a running
# machine.
#
# This is not guaranteed to be called, but this should be implemented
# by every synced folder implementation.
#
# @param [Machine] machine The machine to modify.
# @param [Hash] folders The folders to remove. This will not contain
# any folders that should remain.
# @param [Hash] opts Any options for the synced folders.
def disable(machine, folders, opts)
end
# This is called after destroying the machine during a
# `vagrant destroy` and also prior to syncing folders during
# a `vagrant up`.

View File

@ -9,7 +9,8 @@ module VagrantPlugins
machine.provider_config.functional_vboxsf
end
def prepare(machine, folders, _opts)
def enable(machine, folders, _opts)
# Export the shared folders to the VM
defs = []
folders.each do |id, data|
hostpath = Vagrant::Util::Platform.cygwin_windows_path(data[:hostpath])
@ -17,14 +18,12 @@ module VagrantPlugins
defs << {
name: os_friendly_id(id),
hostpath: hostpath.to_s,
transient: data[:transient],
transient: true,
}
end
driver(machine).share_folders(defs)
end
def enable(machine, folders, _opts)
# short guestpaths first, so we don't step on ourselves
folders = folders.sort_by do |id, data|
if data[:guestpath]