aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-01-20 13:52:48 -0800
committerelijah <elijah@riseup.net>2013-01-20 13:52:48 -0800
commit5ec0237fbb326f5602ee6f7d1cf9ed93c9ec58c6 (patch)
treedf011afe7ae49f9064e624c49fcca6f4a42ddd4d /lib
parentba301b0c8d77ae2f455d3a2d736968c981b8c757 (diff)
downloadleap_cli-5ec0237fbb326f5602ee6f7d1cf9ed93c9ec58c6.tar.gz
leap_cli-5ec0237fbb326f5602ee6f7d1cf9ed93c9ec58c6.tar.bz2
fix bug with rsync when leap command is run from other directories
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/commands/deploy.rb4
-rw-r--r--lib/leap_cli/remote/plugin.rb7
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index a7f6bc3..37901f4 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -88,6 +88,8 @@ module LeapCli
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}
@@ -98,7 +100,7 @@ module LeapCli
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 != '/')
diff --git a/lib/leap_cli/remote/plugin.rb b/lib/leap_cli/remote/plugin.rb
index 213c981..c32b0be 100644
--- a/lib/leap_cli/remote/plugin.rb
+++ b/lib/leap_cli/remote/plugin.rb
@@ -48,7 +48,10 @@ module LeapCli; module Remote; module Plugin
#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
@@ -76,7 +79,7 @@ module LeapCli; module Remote; module Plugin
# 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