The full options data is sent to mount_shared_folder
This commit is contained in:
parent
8a17c350ca
commit
14d61f61ba
|
@ -91,12 +91,15 @@ module Vagrant
|
|||
:name => name,
|
||||
:guest_path => data[:guestpath]))
|
||||
|
||||
# Dup the data so we can pass it to the guest API
|
||||
data = data.dup
|
||||
|
||||
# Calculate the owner and group
|
||||
owner = data[:owner] || @env[:vm].config.ssh.username
|
||||
group = data[:group] || @env[:vm].config.ssh.username
|
||||
data[:owner] ||= @env[:vm].config.ssh.username
|
||||
data[:group] ||= @env[:vm].config.ssh.username
|
||||
|
||||
# Mount the actual folder
|
||||
@env[:vm].guest.mount_shared_folder(name, data[:guestpath], owner, group)
|
||||
@env[:vm].guest.mount_shared_folder(name, data[:guestpath], data)
|
||||
else
|
||||
# If no guest path is specified, then automounting is disabled
|
||||
@env[:ui].info(I18n.t("vagrant.actions.vm.share_folders.nomount_entry",
|
||||
|
|
|
@ -61,7 +61,9 @@ module Vagrant
|
|||
# @param [String] name The name of the shared folder.
|
||||
# @param [String] guestpath The path on the machine which the user
|
||||
# wants the folder mounted.
|
||||
def mount_shared_folder(name, guestpath, owner, group)
|
||||
# @param [Hash] options Additional options for the shared folder
|
||||
# which can be honored.
|
||||
def mount_shared_folder(name, guestpath, options)
|
||||
raise BaseError, :_key => :unsupported_shared_folder
|
||||
end
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
|
||||
def mount_shared_folder(name, guestpath, owner, group)
|
||||
def mount_shared_folder(name, guestpath, options)
|
||||
@vm.channel.sudo("mkdir -p #{guestpath}")
|
||||
mount_folder(name, guestpath, owner, group)
|
||||
@vm.channel.sudo("chown `id -u #{owner}`:`id -g #{group}` #{guestpath}")
|
||||
mount_folder(name, guestpath, options)
|
||||
@vm.channel.sudo("chown `id -u #{options[:owner]}`:`id -g #{options[:group]}` #{guestpath}")
|
||||
end
|
||||
|
||||
def mount_nfs(ip, folders)
|
||||
|
@ -54,9 +54,9 @@ module Vagrant
|
|||
#-------------------------------------------------------------------
|
||||
# "Private" methods which assist above methods
|
||||
#-------------------------------------------------------------------
|
||||
def mount_folder(name, guestpath, owner, group, sleeptime=5)
|
||||
def mount_folder(name, guestpath, options)
|
||||
# Determine the permission string to attach to the mount command
|
||||
options = "-o uid=`id -u #{owner}`,gid=`id -g #{group}`"
|
||||
options = "-o uid=`id -u #{options[:owner]}`,gid=`id -g #{options[:group]}`"
|
||||
|
||||
attempts = 0
|
||||
while true
|
||||
|
@ -69,7 +69,7 @@ module Vagrant
|
|||
|
||||
attempts += 1
|
||||
raise LinuxError, :mount_fail if attempts >= 10
|
||||
sleep sleeptime
|
||||
sleep 5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -90,7 +90,11 @@ module Vagrant
|
|||
end # while
|
||||
end
|
||||
|
||||
def mount_shared_folder(name, guestpath, owner, group)
|
||||
def mount_shared_folder(name, guestpath, options)
|
||||
# These are just far easier to use than the full options syntax
|
||||
owner = options[:owner]
|
||||
group = options[:group]
|
||||
|
||||
# Create the shared folder
|
||||
vm.channel.execute("#{vm.config.solaris.suexec_cmd} mkdir -p #{guestpath}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue