vagrant/plugins/guests/windows/cap/rsync.rb

23 lines
785 B
Ruby
Raw Normal View History

module VagrantPlugins
module GuestWindows
module Cap
class RSync
def self.rsync_scrub_guestpath( machine, opts )
# Windows guests most often use cygwin-dependent rsync utilities
# that expect "/cygdrive/c" instead of "c:" as the path prefix
# some vagrant code may pass guest paths with drive-lettered paths here
opts[:guestpath].gsub( /^([a-zA-Z]):/, '/cygdrive/\1' )
end
def self.rsync_pre(machine, opts)
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
This patch fixes an issue when using rsync folders on windows clients with cygwin & ssh enabled. 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 -------------------------------------------------------------------------------------------------
2017-05-16 07:08:29 +00:00
comm.execute("mkdir -p '#{opts[:guestpath]}'")
end
end
end
end
end
end