providers/virtualbox: don't do transient by default
This commit is contained in:
parent
958684fd7e
commit
f475df0987
|
@ -2,9 +2,6 @@
|
|||
|
||||
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`.
|
||||
- Deprecated: `halt_timeout` and `halt_check_interval` settings for
|
||||
SmartOS, Solaris, and Solaris11 guests. These will be fully
|
||||
removed in 1.7. A warning will be shown if they're in use in
|
||||
|
@ -46,7 +43,7 @@ IMPROVEMENTS:
|
|||
- core: Vagrant locks machine access to one Vagrant process at a time.
|
||||
This will protect against two simultaneous `up` actions happening
|
||||
on the same environment.
|
||||
- core: Boxes can be compressed with LZMA now as well.
|
||||
- core: Boxes can be compressed with LZMA now as well.
|
||||
- commands/box/remove: Warns if the box appears to be in use by an
|
||||
environment. Can be forced with `--force`.
|
||||
- commands/destroy: Exit codes changes. 0 means everything succeeded.
|
||||
|
|
|
@ -117,6 +117,11 @@ module VagrantPlugins
|
|||
# Add this synced folder onto the new config if we haven't
|
||||
# already shared it before.
|
||||
if !existing_ids.has_key?(id)
|
||||
# A bit of a hack for VirtualBox to mount our
|
||||
# folder as transient. This can be removed once
|
||||
# the VirtualBox synced folder mechanism is smarter.
|
||||
data[:virtualbox__transient] = true
|
||||
|
||||
new_config.synced_folder(
|
||||
data[:hostpath],
|
||||
data[:guestpath],
|
||||
|
|
|
@ -9,23 +9,12 @@ module VagrantPlugins
|
|||
machine.provider_config.functional_vboxsf
|
||||
end
|
||||
|
||||
def prepare(machine, folders, _opts)
|
||||
share_folders(machine, folders, false)
|
||||
end
|
||||
|
||||
def enable(machine, folders, _opts)
|
||||
# Export the shared folders to the VM
|
||||
defs = []
|
||||
folders.each do |id, data|
|
||||
hostpath = data[:hostpath]
|
||||
if !data[:hostpath_exact]
|
||||
hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath)
|
||||
end
|
||||
|
||||
defs << {
|
||||
name: os_friendly_id(id),
|
||||
hostpath: hostpath.to_s,
|
||||
transient: true,
|
||||
}
|
||||
end
|
||||
|
||||
driver(machine).share_folders(defs)
|
||||
share_folders(machine, folders, true)
|
||||
|
||||
# short guestpaths first, so we don't step on ourselves
|
||||
folders = folders.sort_by do |id, data|
|
||||
|
@ -94,6 +83,34 @@ module VagrantPlugins
|
|||
def os_friendly_id(id)
|
||||
id.gsub(/[\/]/,'_').sub(/^_/, '')
|
||||
end
|
||||
|
||||
# share_folders sets up the shared folder definitions on the
|
||||
# VirtualBox VM.
|
||||
#
|
||||
# The transient parameter determines if we're FORCING transient
|
||||
# or not. If this is false, then any shared folders will be
|
||||
# shared as non-transient unless they've specifically asked for
|
||||
# transient.
|
||||
def share_folders(machine, folders, transient)
|
||||
defs = []
|
||||
folders.each do |id, data|
|
||||
hostpath = data[:hostpath]
|
||||
if !data[:hostpath_exact]
|
||||
hostpath = Vagrant::Util::Platform.cygwin_windows_path(hostpath)
|
||||
end
|
||||
|
||||
# Only setup the shared folders that match our transient level
|
||||
if (!!data[:transient]) == transient
|
||||
defs << {
|
||||
name: os_friendly_id(id),
|
||||
hostpath: hostpath.to_s,
|
||||
transient: transient,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
driver(machine).share_folders(defs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue