2014-03-26 23:45:46 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module DockerProvider
|
|
|
|
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
|
2014-04-10 15:57:59 +00:00
|
|
|
def usable?(machine, raise_error=false)
|
2014-03-26 23:45:46 +00:00
|
|
|
# These synced folders only work if the provider is Docker
|
2014-04-10 15:57:59 +00:00
|
|
|
if machine.provider_name != :docker
|
|
|
|
if raise_error
|
|
|
|
raise Errors::SyncedFolderNonDocker,
|
|
|
|
provider: machine.provider_name.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
true
|
2014-03-26 23:45:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def prepare(machine, folders, _opts)
|
|
|
|
folders.each do |id, data|
|
2014-04-18 22:53:12 +00:00
|
|
|
next if data[:ignore]
|
|
|
|
|
2014-04-16 18:59:08 +00:00
|
|
|
host_path = data[:hostpath]
|
2014-03-26 23:45:46 +00:00
|
|
|
guest_path = data[:guestpath]
|
|
|
|
machine.provider_config.volumes << "#{host_path}:#{guest_path}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|