end
def calculate_includes_from_files(files)
+ return nil unless files and files.any?
+
# prepend '/' (kind of like ^ for rsync)
includes = files.collect {|file| '/' + file}
end
end
- # include all parent directories
+ # include all parent directories (required because of --exclude '*')
includes.size.times do |i|
path = File.dirname(includes[i])
while(path != '/')
#end
#
- # takes a block, yielded a server, that should return {:source => '', :dest => ''}
+ # takes a block, yielded a server, that should return a hash with various rsync options.
+ # supported options include:
+ #
+ # {:source => '', :dest => '', :flags => '', :includes => [], :excludes => []}
#
def rsync_update
SupplyDrop::Util.thread_pool_size = puppet_parallel_rsync_pool_size
# run command
logger.debug rsync_cmd
- Dir.chdir(options[:chdir] || '.') do
+ Dir.chdir(options[:chdir] || Path.provider) do
ok = system(rsync_cmd)
failed_servers << server.host unless ok
end
end
def excludes(patterns)
- [patterns].flatten.map { |p| "--exclude='#{p}'" }
+ [patterns].flatten.compact.map { |p| "--exclude='#{p}'" }
end
def includes(patterns)
- [patterns].flatten.map { |p| "--include='#{p}'" }
+ [patterns].flatten.compact.map { |p| "--include='#{p}'" }
end
def ssh_options(options)