diff options
author | elijah <elijah@riseup.net> | 2012-10-27 15:13:45 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-10-27 15:13:45 -0700 |
commit | 2bc0fe5aca5afe89647c8416a3d3cd440475121c (patch) | |
tree | 8b3fab72e4fa6b052428064029f66577e3c74016 /lib | |
parent | b649cce68bb5628f02e324ada7fa72177c832a10 (diff) |
minor code cleanup
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/remote/plugin.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/leap_cli/remote/plugin.rb b/lib/leap_cli/remote/plugin.rb index 3fb5160..6b59727 100644 --- a/lib/leap_cli/remote/plugin.rb +++ b/lib/leap_cli/remote/plugin.rb @@ -18,21 +18,25 @@ module LeapCli; module Remote; module Plugin def rsync_update SupplyDrop::Util.thread_pool_size = puppet_parallel_rsync_pool_size servers = SupplyDrop::Util.optionally_async(find_servers, puppet_parallel_rsync) + + # rsync to each server failed_servers = servers.map do |server| - #p server - #p server.options + # build rsync command - _paths = yield server - _source = _paths[:source] - _user = server.user || fetch(:user, ENV['USER']) - _dest = SupplyDrop::Rsync.remote_address(_user, server.host, _paths[:dest]) - _opts = {:ssh => ssh_options.merge(server.options[:ssh_options]||{})} - rsync_cmd = SupplyDrop::Rsync.command(_source, _dest, _opts) + paths = yield server + remote_user = server.user || fetch(:user, ENV['USER']) + rsync_cmd = SupplyDrop::Rsync.command( + paths[:source], + SupplyDrop::Rsync.remote_address(remote_user, server.host, paths[:dest]), + {:ssh => ssh_options.merge(server.options[:ssh_options]||{})} + ) # run command logger.debug rsync_cmd server.host unless system rsync_cmd + end.compact + raise "rsync failed on #{failed_servers.join(',')}" if failed_servers.any? end |