Merge pull request #4274 from sax/smartos_rsync
guests/smartos: rsync on SmartOS should use pfexec
This commit is contained in:
commit
bd94fbd9ba
|
@ -12,13 +12,13 @@ module VagrantPlugins
|
||||||
|
|
||||||
def self.rsync_pre(machine, opts)
|
def self.rsync_pre(machine, opts)
|
||||||
machine.communicate.tap do |comm|
|
machine.communicate.tap do |comm|
|
||||||
comm.sudo("mkdir -p '#{opts[:guestpath]}'")
|
comm.execute("#{machine.config.smartos.suexec_cmd} mkdir -p '#{opts[:guestpath]}'")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.rsync_post(machine, opts)
|
def self.rsync_post(machine, opts)
|
||||||
machine.communicate.sudo("find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
|
machine.communicate.execute("find '#{opts[:guestpath]}' '(' ! -user #{opts[:owner]} -or ! -group #{opts[:group]} ')' -print0 | " +
|
||||||
"xargs -0 -r chown #{opts[:owner]}:#{opts[:group]}")
|
"#{machine.config.smartos.suexec_cmd} xargs -0 chown #{opts[:owner]}:#{opts[:group]}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,5 +30,19 @@ describe "VagrantPlugins::VagrantPlugins::Cap::Rsync" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe ".rsync_pre" do
|
||||||
|
it 'makes the guestpath directory with pfexec' do
|
||||||
|
communicator.expect_command("pfexec mkdir -p '/sync_dir'")
|
||||||
|
plugin.rsync_pre(machine, guestpath: '/sync_dir')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe ".rsync_post" do
|
||||||
|
it 'chowns incorrectly owned files in sync dir' do
|
||||||
|
communicator.expect_command("find '/sync_dir' '(' ! -user somebody -or ! -group somegroup ')' -print0 | pfexec xargs -0 chown somebody:somegroup")
|
||||||
|
plugin.rsync_post(machine, guestpath: '/sync_dir', owner: 'somebody', group: 'somegroup')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue