guests/linux: don't chown VB shared folders if readonly [GH-2442]

This commit is contained in:
Mitchell Hashimoto 2014-02-04 16:01:14 +01:00
parent 8bd073f08a
commit 226dbccef8
2 changed files with 11 additions and 6 deletions

View File

@ -72,6 +72,8 @@ BUG FIXES:
rather than at runtime. rather than at runtime.
- commands/ssh: When using `-c` on Windows, no more TTY errors. - commands/ssh: When using `-c` on Windows, no more TTY errors.
- guests/coreos: Restart etcd after configuring networks. [GH-2852] - guests/coreos: Restart etcd after configuring networks. [GH-2852]
- guests/linux: Don't chown VirtualBox synced folders if mounting
as readonly. [GH-2442]
- guests/redhat: Set hostname to FQDN, per the documentation for RedHat. - guests/redhat: Set hostname to FQDN, per the documentation for RedHat.
[GH-2792] [GH-2792]
- hosts/bsd: Don't invoke shell for NFS sudo calls. [GH-2808] - hosts/bsd: Don't invoke shell for NFS sudo calls. [GH-2808]

View File

@ -62,13 +62,16 @@ module VagrantPlugins
sleep 2 sleep 2
end end
# Chown the directory to the proper user # Chown the directory to the proper user. We skip this if the
# mount options contained a readonly flag, because it won't work.
if !opts[:mount_options].include?("ro")
chown_commands = [] chown_commands = []
chown_commands << "chown #{mount_uid}:#{mount_gid} #{expanded_guest_path}" chown_commands << "chown #{mount_uid}:#{mount_gid} #{expanded_guest_path}"
chown_commands << "chown #{mount_uid}:#{mount_gid_old} #{expanded_guest_path}" chown_commands << "chown #{mount_uid}:#{mount_gid_old} #{expanded_guest_path}"
exit_status = machine.communicate.sudo(chown_commands[0], error_check: false) exit_status = machine.communicate.sudo(chown_commands[0], error_check: false)
machine.communicate.sudo(chown_commands[1]) if exit_status != 0 machine.communicate.sudo(chown_commands[1]) if exit_status != 0
end
# Emit an upstart event if we can # Emit an upstart event if we can
if machine.communicate.test("test -x /sbin/initctl") if machine.communicate.test("test -x /sbin/initctl")