guests/linux: rsync only chown if invalid user/group [GH-3186]

This commit is contained in:
Mitchell Hashimoto 2014-03-13 09:47:34 -07:00
parent 1213b87679
commit 00d73eabda
2 changed files with 8 additions and 4 deletions

View File

@ -24,6 +24,8 @@ BUG FIXES:
- core: Downloads with user/password use the curl `-u` flag. [GH-3183]
- core: `vagrant help` no longer loads the Vagrantfile. [GH-3180]
- guests/darwin: Fix an exception when configuring networks. [GH-3143]
- guests/linux: Only chown folders/files in rsync if they don't
have the proper owner. [GH-3186]
- hosts/linux: Unusual sed delimiter to avoid conflicts. [GH-3167]
- providers/virtualbox: Make more internal interactions with VBoxManage
retryable to avoid spurious VirtualBox errors. [GH-2831]

View File

@ -6,18 +6,20 @@ module VagrantPlugins
machine.communicate.test("which rsync")
end
def self.rsync_pre(machine, folder_opts)
def self.rsync_pre(machine, opts)
username = machine.ssh_info[:username]
machine.communicate.tap do |comm|
comm.sudo("mkdir -p '#{folder_opts[:guestpath]}'")
comm.sudo("chown -R #{username} '#{folder_opts[:guestpath]}'")
comm.sudo("mkdir -p '#{opts[:guestpath]}'")
comm.sudo("find '#{opts[:guestpath]}' ! -user vagrant -print0 | " +
"xargs -0 -r chown -v #{username}:")
end
end
def self.rsync_post(machine, opts)
machine.communicate.tap do |comm|
comm.sudo("chown -R #{opts[:owner]}:#{opts[:group]} '#{opts[:guestpath]}'")
comm.sudo("find '#{opts[:guestpath]}' ! -user vagrant -print0 | " +
"xargs -0 -r chown -v #{opts[:owner]}:#{opts[:group]}")
end
end
end