synced_folders/rsync: rsync__chown [GH-3810]

This commit is contained in:
Mitchell Hashimoto 2014-05-17 12:01:50 -07:00
parent e107202050
commit 34b7cace7b
5 changed files with 19 additions and 0 deletions

View File

@ -15,6 +15,8 @@ BUG FIXES:
- guests/freebsd: Properly register the rsync_pre capability - guests/freebsd: Properly register the rsync_pre capability
- guests/windows: Certain executed provisioners won't leave output - guests/windows: Certain executed provisioners won't leave output
and exit status behind. [GH-3729] and exit status behind. [GH-3729]
- synced\_folders/rsync: `rsync__chown` can be set to `false` to
disable recursive chown after sync. [GH-3810]
## 1.6.2 (May 12, 2014) ## 1.6.2 (May 12, 2014)

View File

@ -17,6 +17,10 @@ module VagrantPlugins
end end
def self.rsync_post(machine, opts) def self.rsync_post(machine, opts)
if opts.has_key?(:chown) && !opts[:chown]
return
end
machine.communicate.sudo( machine.communicate.sudo(
"find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " + "find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
"xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}") "xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}")

View File

@ -23,6 +23,10 @@ module VagrantPlugins
end end
def self.rsync_post(machine, opts) def self.rsync_post(machine, opts)
if opts.has_key?(:chown) && !opts[:chown]
return
end
machine.communicate.sudo( machine.communicate.sudo(
"find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " + "find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
"xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}") "xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}")

View File

@ -17,6 +17,10 @@ module VagrantPlugins
end end
def self.rsync_post(machine, opts) def self.rsync_post(machine, opts)
if opts.has_key?(:chown) && !opts[:chown]
return
end
machine.communicate.sudo( machine.communicate.sudo(
"find '#{opts[:guestpath]}' " + "find '#{opts[:guestpath]}' " +
"'!' -type l -a " + "'!' -type l -a " +

View File

@ -45,6 +45,11 @@ The rsync synced folder type accepts the following options:
* `rsync__auto` (boolean) - If false, then `rsync-auto` will not * `rsync__auto` (boolean) - If false, then `rsync-auto` will not
watch and automatically sync this folder. By default, this is true. watch and automatically sync this folder. By default, this is true.
* `rsync__chown` (boolean) - If false, then the `owner` and `group`
options for the synced folder are ignored and Vagrant won't execute
a recursive `chown`. This defaults to true. This option exists because
the `chown` causes issues for some development environments.
* `rsync__exclude` (string or array of strings) - A list of files or directories * `rsync__exclude` (string or array of strings) - A list of files or directories
to exclude from the sync. The values can be any acceptable rsync exclude to exclude from the sync. The values can be any acceptable rsync exclude
pattern. By default, the ".vagrant/" directory is excluded. We recommend pattern. By default, the ".vagrant/" directory is excluded. We recommend