synced_folders/rsync: execute rsync_post cap if it exists [GH-3163]
This commit is contained in:
parent
67e9257332
commit
a6eafd6a12
|
@ -20,6 +20,7 @@ BUG FIXES:
|
||||||
retryable to avoid spurious VirtualBox errors. [GH-2831]
|
retryable to avoid spurious VirtualBox errors. [GH-2831]
|
||||||
- provisioners/ansible: Request SSH info within the provision method,
|
- provisioners/ansible: Request SSH info within the provision method,
|
||||||
when we know its available. [GH-3111]
|
when we know its available. [GH-3111]
|
||||||
|
- synced\_folders/rsync: owner/group settings work. [GH-3163]
|
||||||
|
|
||||||
## 1.5.0 (March 10, 2014)
|
## 1.5.0 (March 10, 2014)
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,12 @@ module VagrantPlugins
|
||||||
comm.sudo("chown -R #{username} '#{folder_opts[:guestpath]}'")
|
comm.sudo("chown -R #{username} '#{folder_opts[:guestpath]}'")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.rsync_post(machine, opts)
|
||||||
|
machine.communicate.tap do |comm|
|
||||||
|
comm.sudo("chown -R #{opts[:owner]}:#{opts[:group]} '#{opts[:guestpath]}'")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,6 +61,11 @@ module VagrantPlugins
|
||||||
Cap::RSync
|
Cap::RSync
|
||||||
end
|
end
|
||||||
|
|
||||||
|
guest_capability("linux", "rsync_post") do
|
||||||
|
require_relative "cap/rsync"
|
||||||
|
Cap::RSync
|
||||||
|
end
|
||||||
|
|
||||||
guest_capability("linux", "rsync_pre") do
|
guest_capability("linux", "rsync_pre") do
|
||||||
require_relative "cap/rsync"
|
require_relative "cap/rsync"
|
||||||
Cap::RSync
|
Cap::RSync
|
||||||
|
|
|
@ -24,6 +24,10 @@ module VagrantPlugins
|
||||||
hostpath += "/"
|
hostpath += "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Folder options
|
||||||
|
opts[:owner] ||= ssh_info[:username]
|
||||||
|
opts[:group] ||= ssh_info[:username]
|
||||||
|
|
||||||
# Connection information
|
# Connection information
|
||||||
username = ssh_info[:username]
|
username = ssh_info[:username]
|
||||||
host = ssh_info[:host]
|
host = ssh_info[:host]
|
||||||
|
@ -77,6 +81,11 @@ module VagrantPlugins
|
||||||
hostpath: hostpath,
|
hostpath: hostpath,
|
||||||
stderr: r.stderr
|
stderr: r.stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If we have tasks to do after rsyncing, do those.
|
||||||
|
if machine.guest.capability?(:rsync_post)
|
||||||
|
machine.guest.capability(:rsync_post, opts)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -122,6 +122,14 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
|
||||||
subject.rsync_single(machine, ssh_info, opts)
|
subject.rsync_single(machine, ssh_info, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "executes the rsync_post capability after if it exists" do
|
||||||
|
guest.should_receive(:capability?).with(:rsync_post).and_return(true)
|
||||||
|
Vagrant::Util::Subprocess.should_receive(:execute).ordered.and_return(result)
|
||||||
|
guest.should_receive(:capability).with(:rsync_post, opts).ordered
|
||||||
|
|
||||||
|
subject.rsync_single(machine, ssh_info, opts)
|
||||||
|
end
|
||||||
|
|
||||||
context "excluding files" do
|
context "excluding files" do
|
||||||
it "excludes files if given as a string" do
|
it "excludes files if given as a string" do
|
||||||
opts[:exclude] = "foo"
|
opts[:exclude] = "foo"
|
||||||
|
|
Loading…
Reference in New Issue