From 630858b9a8fee433d94705961503ead5748b0c8e Mon Sep 17 00:00:00 2001 From: Tim Aslat Date: Tue, 16 May 2017 16:38:29 +0930 Subject: [PATCH 1/2] This patch fixes an issue when using rsync folders on windows clients with cygwin & ssh enabled. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the patch this error will happen if the original directory already exists ------------------------------------------------------------------------------------------------- ==> windows: Rsyncing folder: /vhosts/oxfamshop.com.au/ => /cygdrive/c/inetpub/wwwroot ==> windows: - Exclude: [".vagrant/", ".git/", "target/", "node_modules/"] ==> windows: Showing rsync output... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed! mkdir '/cygdrive/c/inetpub/wwwroot' Stdout from the command: Stderr from the command: mkdir: cannot create directory ‘/cygdrive/c/inetpub/wwwroot’: File exists ------------------------------------------------------------------------------------------------- After the patch, this is result ------------------------------------------------------------------------------------------------- ==> windows: Rsyncing folder: /vhosts/oxfamshop.com.au/ => /cygdrive/c/inetpub/wwwroot ==> windows: - Exclude: [".vagrant/", ".git/", "target/", "node_modules/"] ==> windows: Showing rsync output... ==> windows: rsync[stdout] -> sending incremental file list ==> windows: rsync[stdout] -> ==> windows: rsync[stdout] -> sent 500855 bytes received 6635 bytes 78075.38 bytes/sec ==> windows: rsync[stdout] -> total size is 175357552 speedup is 345.54 ------------------------------------------------------------------------------------------------- --- plugins/guests/windows/cap/rsync.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/windows/cap/rsync.rb b/plugins/guests/windows/cap/rsync.rb index aa9f1bcdf..bf2456249 100644 --- a/plugins/guests/windows/cap/rsync.rb +++ b/plugins/guests/windows/cap/rsync.rb @@ -13,7 +13,7 @@ module VagrantPlugins machine.communicate.tap do |comm| # rsync does not construct any gaps in the path to the target directory # make sure that all subdirectories are created - comm.execute("mkdir '#{opts[:guestpath]}'") + comm.execute("mkdir -p '#{opts[:guestpath]}'") end end end From 7f675d723cff5549959923b709dfd96f05cfb0f7 Mon Sep 17 00:00:00 2001 From: Tim Aslat Date: Thu, 18 May 2017 16:06:27 +0930 Subject: [PATCH 2/2] Update unit test to match fix --- test/unit/plugins/guests/windows/cap/rsync_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/plugins/guests/windows/cap/rsync_test.rb b/test/unit/plugins/guests/windows/cap/rsync_test.rb index d32568c40..e55006512 100644 --- a/test/unit/plugins/guests/windows/cap/rsync_test.rb +++ b/test/unit/plugins/guests/windows/cap/rsync_test.rb @@ -19,7 +19,7 @@ describe "VagrantPlugins::GuestWindows::Cap::RSync" do describe ".rsync_pre" do it 'makes the guestpath directory with mkdir' do - communicator.expect_command("mkdir '/sync_dir'") + communicator.expect_command("mkdir -p '/sync_dir'") described_class.rsync_pre(machine, guestpath: '/sync_dir') end end