Module: ZTK::SSH::Upload
- Included in:
- ZTK::SSH
- Defined in:
- lib/ztk/ssh/upload.rb
Overview
SSH Upload Functionality
Instance Method Summary (collapse)
-
- (Boolean) upload(local, remote, options = {})
Uploads a local file to a remote host.
Instance Method Details
- (Boolean) upload(local, remote, options = {})
Uploads a local file to a remote host.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ztk/ssh/upload.rb', line 30 def upload(local, remote, ={}) = { :recursive => false, :use_scp => false }.merge() = OpenStruct.new(config.send(:table).merge()) .ui.logger.debug { "config=#{config.send(:table).inspect}" } .ui.logger.debug { "options=#{.send(:table).inspect}" } config.ui.logger.info { "upload(#{local.inspect}, #{remote.inspect})" } ZTK::RescueRetry.try(:ui => config.ui, :tries => ZTK::SSH::RESCUE_RETRY_ATTEMPTS, :on_retry => method(:on_retry)) do if (.use_scp == true) scp_upload(local, remote, ) else sftp_upload(local, remote, ) end end true end |